throw instantiation error if the list of options contains a variable (#523)

Many thanks to @notoria for the test case!
This commit is contained in:
Markus Triska
2020-05-18 09:58:09 +02:00
parent 3855d7ea02
commit 95ca8a2630

View File

@@ -259,6 +259,10 @@ crypto_data_hkdf(Data0, L, Bytes, Options0) :-
'$crypto_data_hkdf'(Data, SaltBytes, Info, Algorithm, L, Bytes).
option(What, Options, Default) :-
( member(V, Options), var(V) ->
instantiation_error(option/3)
; true
),
( member(What, Options) -> true
; What =.. [_,Default]
).