From: Markus Triska Date: Mon, 18 May 2020 11:11:39 +0000 (+0200) Subject: crypto_password_hash/3: fail if the number of iterations is too high X-Git-Tag: v0.8.123~17^2~2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=fac7ba70c87a3c69daec45bd18d078920ff0b510;p=scryer-prolog.git crypto_password_hash/3: fail if the number of iterations is too high Discussed in #527. --- diff --git a/src/prolog/machine/system_calls.rs b/src/prolog/machine/system_calls.rs index 4061bdbc..17d456ed 100644 --- a/src/prolog/machine/system_calls.rs +++ b/src/prolog/machine/system_calls.rs @@ -5285,7 +5285,10 @@ impl MachineState { u64::try_from(n).unwrap() } Ok(Number::Integer(n)) => { - n.to_u64().unwrap() + match n.to_u64() { + Some(i) => { i } + None => { self.fail = true; return Ok(()); } + } } _ => { unreachable!()