unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: egh@e6h.org, 42113@debbugs.gnu.org
Subject: bug#42113: 28.0.50; Segmentation fault in json-parse-file
Date: Mon, 29 Jun 2020 12:07:33 +0200	[thread overview]
Message-ID: <CAArVCkQg6qOSxUVUtgORa7yfgt4w2eg3z1saZP0w_=OVO=Ojwg@mail.gmail.com> (raw)
In-Reply-To: <5613F080-14DE-4562-BDA1-FD439C9FBF5D@gnu.org>

Am Mo., 29. Juni 2020 um 11:39 Uhr schrieb Eli Zaretskii <eliz@gnu.org>:
>
> On June 29, 2020 11:33:45 AM GMT+03:00, Philipp Stephani <p.stephani2@gmail.com> wrote:
> > Am So., 28. Juni 2020 um 23:53 Uhr schrieb Erik Hetzner <egh@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?





  reply	other threads:[~2020-06-29 10:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-28 21:52 bug#42113: 28.0.50; Segmentation fault in json-parse-file Erik Hetzner
2020-06-28 22:29 ` Erik Hetzner
2020-06-29  8:33 ` Philipp Stephani
2020-06-29  9:39   ` Eli Zaretskii
2020-06-29 10:07     ` Philipp Stephani [this message]
2020-06-29 14:56       ` Eli Zaretskii
2020-06-29 10:37   ` Philipp Stephani
2020-06-29 15:39     ` Erik Hetzner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAArVCkQg6qOSxUVUtgORa7yfgt4w2eg3z1saZP0w_=OVO=Ojwg@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=42113@debbugs.gnu.org \
    --cc=egh@e6h.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).