1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-09 12:06:01 +01:00

tests/functional/lang: Add tests for builtins.fromTOML overflow

This adds regression tests for fromTOML overflow/underflow behavior.
Previous versions of toml11 used to saturate, but this was never an
intended behavior (and Snix/Nix 2.3/toml11 >= 4.0 validate this).

(cherry picked from Lix [1,2])

[1]: 7ee442079d
[2]: 4de09b6b54
This commit is contained in:
Emily 2025-08-14 17:15:17 +01:00 committed by Sergei Zimmerman
parent 8251305aff
commit acd627fa46
No known key found for this signature in database
4 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,13 @@
error:
… while calling the 'fromTOML' builtin
at /pwd/lang/eval-fail-fromTOML-overflow.nix:1:1:
1| builtins.fromTOML ''attr = 9223372036854775808''
| ^
2|
error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63
--> fromTOML
|
1 | attr = 9223372036854775808
| ^-- must be < 2^63

View file

@ -0,0 +1 @@
builtins.fromTOML ''attr = 9223372036854775808''

View file

@ -0,0 +1,13 @@
error:
… while calling the 'fromTOML' builtin
at /pwd/lang/eval-fail-fromTOML-underflow.nix:1:1:
1| builtins.fromTOML ''attr = -9223372036854775809''
| ^
2|
error: while parsing TOML: [error] toml::parse_dec_integer: too large integer: current max digits = 2^63
--> fromTOML
|
1 | attr = -9223372036854775809
| ^-- must be < 2^63

View file

@ -0,0 +1 @@
builtins.fromTOML ''attr = -9223372036854775809''