jsown icon indicating copy to clipboard operation
jsown copied to clipboard

Memory Fault Error on SBCL when given bad JSON

Open MistressRemilia opened this issue 5 years ago • 1 comments

Hey,

Attempting to parse the following incorrect JSON makes SBCL 2.0.8 pause for several seconds, then raise the error "Unhandled memory fault at #x1200000000. [Condition of type SB-SYS:MEMORY-FAULT-ERROR]".

(jsown:parse "{\"foo\": a}")

I tested this on CCL and Clisp as well. In those, I immediately get an error complaining that an index is out of range for ELT.

MistressRemilia avatar Sep 04 '20 02:09 MistressRemilia

Here is the culprit:

https://github.com/madnificent/jsown/blob/744c4407bef58dfa876d9da0b5c0205d869e7977/reader.lisp#L3-L4

Either use (sb-ext:restrict-compiler-policy 'safety 1) when compiling jsown or switch to a JSON parser which does not commit atrocities like the above.

The latter is IMO much better, but keep in mind that I have very strong opinions on the subject.

phoe avatar Feb 10 '22 21:02 phoe