fix: Prevent panic by Number::modulo (#773)

In Number::modulo, it calls Number::ints_to_bigint, which could panic. The reason is that calling .to_integer() isn't enough to guarantee that .to_bigint_owned() will return Some, but Number::ints_to_bigint assumes it will and calls unwrap(). In particular, it might be that it's a float corresponding to an integer that's larger than F64_SAFE_INTEGER. The fix is to not call Number::ints_to_bigint (and indeed to delete that entire function, which is only used in this one place), and instead only call unwrap when Some is returned.
This commit is contained in:
Jay Lorch
2026-07-27 12:06:42 -07:00
committed by GitHub
parent e468255657
commit 839510df56
2 changed files with 43 additions and 10 deletions

View File

@@ -62,3 +62,12 @@ cases:
x = 1 % 1.1
query: data.test
error: modulo on floating-point number
- note: integral float too large to convert
data: {}
modules:
- |
package test
x = 100000000000000000e-1 % 2
query: data.test
error: modulo on floating-point number