Opened 10 years ago

Closed 10 years ago

Last modified 9 years ago

#513 closed defect (fixed)

json-abnf chokes on escapes in strings

Reported by: Moritz Heidkamp Owned by: Ivan Raikov
Priority: major Milestone: 4.9.0
Component: extensions Version: 4.6.x
Keywords: json-abnf Cc:
Estimated difficulty:

Description

Parsing JSON strings containing escape sequences like "\n" or "\u0040" fails. To reproduce this, try:

(use json-abnf)
(parser "[\"\\n\"]")

which results in:

JSON parser error on stream: ["\n"]

Error: (caar) bad argument type: ()

        Call history:

        <syntax>          (parser "[\"\\n\"]")
        <eval>    (parser "[\"\\n\"]")
        string->list      
        p291      
        lexgen#bar        
        lexgen#bar        
        lexgen#bar        
        lexgen#bar        
        lexgen#bar        
        lexgen#bar        
        print           <--

Change History (6)

comment:1 Changed 10 years ago by Ivan Raikov

Resolution: fixed
Status: newclosed

Fixed in json-abnf release 3.2

comment:2 Changed 10 years ago by Moritz Heidkamp

Resolution: fixed
Status: closedreopened

Thanks for the quick fix, Ivan! Now there is another problem: For some reason, strings containing exclamation points still lead to the same error, i.e. the string "!" causes the parser to fail. However, I can't find any special-casing of #\! in the code. Can you see what's going on?

comment:3 in reply to:  2 Changed 10 years ago by Ivan Raikov

I used ucs-range->char-set to create the character sets representing valid characters in a string, but because I didn't RTFSRFI, I didn't realise it excludes the upper bound from the created set. This has been fixed now.

Replying to syn:

Thanks for the quick fix, Ivan! Now there is another problem: For some reason, strings containing exclamation points still lead to the same error, i.e. the string "!" causes the parser to fail. However, I can't find any special-casing of #\! in the code. Can you see what's going on?

comment:4 Changed 10 years ago by Ivan Raikov

Resolution: fixed
Status: reopenedclosed

comment:5 Changed 10 years ago by felix winkelmann

Milestone: 4.7.04.8.0

Milestone 4.7.0 deleted

comment:6 Changed 9 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.