]> Repositorios git - scryer-prolog.git/commitdiff
crypto_password_hash/3: fail if the number of iterations is too high
authorMarkus Triska <[email protected]>
Mon, 18 May 2020 11:11:39 +0000 (13:11 +0200)
committerMarkus Triska <[email protected]>
Mon, 18 May 2020 11:11:39 +0000 (13:11 +0200)
Discussed in #527.

src/prolog/machine/system_calls.rs

index 4061bdbc8731015000b92a21bf369a134606ba59..17d456ed751fce882508d0a802bcde42f20ca191 100644 (file)
@@ -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!()