mthom / scryer-prolog

A modern Prolog implementation written mostly in Rust.
BSD 3-Clause "New" or "Revised" License
2.05k stars 120 forks source link

number_chars/2 leak #1337

Open UWN opened 2 years ago

UWN commented 2 years ago
ulrich@g1:/opt/gupu/scryer-prolog$ ulimit -v
80000
ulrich@g1:/opt/gupu/scryer-prolog$ target/release/scryer-prolog -f
?- repeat, number_chars(N,"12345678901234567890"), N = 0.
GNU MP: Cannot allocate memory (size=24)
Aborted (core dumped)
ulrich@g1:/opt/gupu/scryer-prolog$ git describe
v0.9.0-20-gd83b32a
UWN commented 2 years ago

More precisely,

?- repeat, number_chars(N,"0xFFFFFFFFFFFFFF"), N = 0.
^Ccaught: error('$interrupt_thrown',repl/0) % seems to work
?- repeat, number_chars(N,"0x100000000000000"), N = 0.
memory allocation of 34 bytes failed % smallest number with the problem
Aborted (core dumped)