GNU bug report logs - #42113
28.0.50; Segmentation fault in json-parse-file

Previous Next

Package: emacs;

Reported by: Erik Hetzner <egh <at> e6h.org>

Date: Sun, 28 Jun 2020 21:53:01 UTC

Severity: normal

Found in version 28.0.50

Done: Philipp Stephani <p.stephani2 <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Philipp Stephani <p.stephani2 <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: egh <at> e6h.org, 42113 <at> debbugs.gnu.org
Subject: bug#42113: 28.0.50; Segmentation fault in json-parse-file
Date: Mon, 29 Jun 2020 12:07:33 +0200
Am Mo., 29. Juni 2020 um 11:39 Uhr schrieb Eli Zaretskii <eliz <at> gnu.org>:
>
> On June 29, 2020 11:33:45 AM GMT+03:00, Philipp Stephani <p.stephani2 <at> gmail.com> wrote:
> > Am So., 28. Juni 2020 um 23:53 Uhr schrieb Erik Hetzner <egh <at> e6h.org>:
> > >
> > > 1. Start emacs -Q
> > > 2. Evaluate the following
> > > (require 'dom)
> > >
> > > (with-current-buffer (url-retrieve-synchronously
> > "https://www.seriouseats.com/recipes/2020/06/florentine-omelette-spinach-and-cheese.html")
> > >         (let* ((dom (libxml-parse-html-region (point-min)
> > (point-max)))
> > >                (scripts (dom-by-tag dom 'script))
> > >                (json-lds-raw (dom-elements scripts 'type
> > "^application/ld\\+json$"))
> > >                (json-lds (mapcar #'json-parse-string
> > json-lds-raw)))))
> > >
> > > Result: segmentation fault.
> >
> > Simpler: (json-parse-string 1)
> > The JSON functions are missing CHECK_STRING in several places where
> > json_encode is called.
>
> In this specific case I think the test is there, but it is done a bit too late.  The call to check_string_without_embedded_nuls should be moved before json_encode.

Is that always guaranteed to be correct though? Is there a guarantee
that encoding can never produce null bytes that weren't already
present in the input?




This bug report was last modified 5 years and 14 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.