Skip to content

Commit 52cab39

Browse files
committed
Wrap for 64-bit pointers
1 parent 2999432 commit 52cab39

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

dsc_lib/src/functions/index_of.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ impl Function for IndexOf {
4848
};
4949

5050
if matches {
51-
return Ok(Value::Number((index as i64).into()));
51+
let index_i64 = i64::try_from(index).map_err(|_| {
52+
DscError::Parser("Array index too large to represent as integer".to_string())
53+
})?;
54+
return Ok(Value::Number(index_i64.into()));
5255
}
5356
}
5457

0 commit comments

Comments
 (0)