GNU bug report logs -
#48274
27.2; libjanson: \u0000 is not allowed without JSON_ALLOW_NUL
Previous Next
Reported by: "Peter" <craven <at> gmx.net>
Date: Fri, 7 May 2021 07:18:01 UTC
Severity: normal
Found in version 27.2
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 48274 <at> debbugs.gnu.org (full text, mbox):
> Am 07.05.2021 um 09:16 schrieb Peter <craven <at> gmx.net>:
>
> Hello ;)
>
> It seems that Emacs' `json-parse-buffer' cannot correctly parse strings
> that contain an escaped ascii 0 value.
>
> To reproduce:
>
> - Create a new buffer, insert into it:
> { "foo": "this is a string including a literal \u0000" }
> - Move point to the beginning of the buffer [ M-< ]
> - Execute `json-parse-buffer' [ M-: (json-parse-buffer) ]
> - See the error message.
>
> According to all other systems I've tried, \u0000 is valid in json
> strings.
>
> The error message seems to imply that something (probably libjanson?)
> should be compiled with -DJSON_ALLOW_NUL.
>
> As this seems to be non-conformant behaviour, is there a way to change
> this in the default Emacs build?
We use the default behavior of Jansson here, see the remark about JSON_ALLOW_NUL in https://jansson.readthedocs.io/en/2.13/apiref.html#decoding.
I wouldn't mind allowing escaped NUL characters though; Emacs should be able to handle them just fine.
Also see the FIXME in the unit test `json-parse-string/null' in tests/src/json-tests.el.
This bug report was last modified 2 years and 320 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.