jscl
jscl copied to clipboard
REPL crash
One can easily crash the REPL trying to evaluate a large number, such as 1d999.
Very interesting.
Compare
(progn (read-from-string "1d999") nil) ;; works
(progn 1d999 nil) ; hangs!
First one suggests that is not the reader. But (read-from-string "1d999") fails.. so maybe the printer? but the second example is not printed at all.
This is a reader error, not printer. If it was the printer, the latter test of yours would work. Additionally SBCL explicitly gives an error as:
READER-ERROR at 5 on #<SB-IMPL::STRING-INPUT-STREAM {100376C6E3}>:
failed to build float from 1d999
Original error: Too large to be represented as a DOUBLE-FLOAT:
10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
[Condition of type SB-KERNEL:READER-IMPOSSIBLE-NUMBER-ERROR]
This is a lesser known issue as to why it is very difficult to create a sandboxable Common Lisp...more than just a subset of symbols need to be considered.
But if it is reader, how the first example (progn (read-from-string "1d999") nil) works?
Or even (integerp (read-from-string "1d999")). Or at least they don't hang.
The first example produces the same error on SBCL, so I assume an implementation problem found as a result of the first bug.
Sure, but setting aside the fact that we could signal an error. I would expect the code still to just give a meaningless result, but never to hang. But I am not sure where it hangs.
I'll have a look.
hanks for reporting it!