]> Repositorios git - scryer-prolog.git/commitdiff
add range check to arg/3 (#1250) rebis-dev_improved-length origin/rebis-dev_improved-length
authorMark Thom <[email protected]>
Sat, 29 Jan 2022 19:50:09 +0000 (12:50 -0700)
committerMark Thom <[email protected]>
Sat, 29 Jan 2022 19:50:09 +0000 (12:50 -0700)
src/machine/machine_state_impl.rs

index 373f87048b718d6b7868b20d5f0491cd9bbec02f..50b5144ca9430b0793a482e4597f14fa52df808c 100644 (file)
@@ -2080,7 +2080,7 @@ impl MachineState {
 
                 let n = match n {
                     Number::Fixnum(n) => n.get_num() as usize,
-                    Number::Integer(n) => n.to_usize().unwrap(),
+                    Number::Integer(n) if *n >= 0 && *n <= std::usize::MAX => n.to_usize().unwrap(),
                     _ => {
                         self.fail = true;
                         return Ok(());