From mboxrd@z Thu Jan 1 00:00:00 1970
Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail
From: Philipp Stephani
Newsgroups: gmane.emacs.bugs
Subject: bug#42113: 28.0.50; Segmentation fault in json-parse-file
Date: Mon, 29 Jun 2020 12:07:33 +0200
Message-ID:
References: <5ef91115.1c69fb81.aa1e3.9577@mx.google.com>
<5613F080-14DE-4562-BDA1-FD439C9FBF5D@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202";
logging-data="47608"; mail-complaints-to="usenet@ciao.gmane.io"
Cc: egh@e6h.org, 42113@debbugs.gnu.org
To: Eli Zaretskii
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jun 29 12:08:11 2020
Return-path:
Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org
Original-Received: from lists.gnu.org ([209.51.188.17])
by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.92)
(envelope-from )
id 1jpqhu-000CIB-Q5
for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Jun 2020 12:08:10 +0200
Original-Received: from localhost ([::1]:50784 helo=lists1p.gnu.org)
by lists.gnu.org with esmtp (Exim 4.90_1)
(envelope-from )
id 1jpqht-0006Lz-Qa
for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Jun 2020 06:08:09 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55254)
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1jpqhm-0006K7-IC
for bug-gnu-emacs@gnu.org; Mon, 29 Jun 2020 06:08:02 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:36483)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from )
id 1jpqhm-0005YF-4Q
for bug-gnu-emacs@gnu.org; Mon, 29 Jun 2020 06:08:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
(envelope-from ) id 1jpqhl-000183-Vl
for bug-gnu-emacs@gnu.org; Mon, 29 Jun 2020 06:08:01 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Philipp Stephani
Original-Sender: "Debbugs-submit"
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Mon, 29 Jun 2020 10:08:01 +0000
Resent-Message-ID:
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 42113
X-GNU-PR-Package: emacs
X-Debbugs-Original-Cc: Erik Hetzner , bug-gnu-emacs@gnu.org,
42113@debbugs.gnu.org
Original-Received: via spool by submit@debbugs.gnu.org id=B.15934252714316
(code B ref -1); Mon, 29 Jun 2020 10:08:01 +0000
Original-Received: (at submit) by debbugs.gnu.org; 29 Jun 2020 10:07:51 +0000
Original-Received: from localhost ([127.0.0.1]:48027 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from )
id 1jpqha-00017X-PA
for submit@debbugs.gnu.org; Mon, 29 Jun 2020 06:07:51 -0400
Original-Received: from lists.gnu.org ([209.51.188.17]:48860)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from ) id 1jpqhY-00017K-J3
for submit@debbugs.gnu.org; Mon, 29 Jun 2020 06:07:49 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55186)
by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.90_1) (envelope-from )
id 1jpqhY-00062k-Dw
for bug-gnu-emacs@gnu.org; Mon, 29 Jun 2020 06:07:48 -0400
Original-Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:36762)
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from )
id 1jpqhW-0005Ro-Ii; Mon, 29 Jun 2020 06:07:48 -0400
Original-Received: by mail-ot1-x32e.google.com with SMTP id 72so14951469otc.3;
Mon, 29 Jun 2020 03:07:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=fdMoftu7pqRBAMuQL6xZytcp+QJvwVkWDZxQFiiA60Q=;
b=SgbdR+gQJwCAMSXdJYydn7P7IUsFg6iskuRvAvznjrymLd0G4G8yEVe7dk9ck0c1BR
GCPrArXHevr7O3lXRElXWej1isgPei5784kPbrJGy5I7RLjdf23+8Kb+VFiVLZrFsy1A
dB8pApvB/+XMXWt4KhlUyEmaLAnVP5Pe59ThlJMCN6+mcIykVnGQqC3jaMLoL2HLxpOD
ri+M9iyCZ4MOs48JJS7D4oEqDzgl7ZEmUmLju54BQfczjTMP2C55OAAu+FVm21lNl3Yg
ZJBK35N0iQlGNTBQGwuSWr/0mpjoonsa6ZIUgQA+ay8YEVfqhx/MbCEV9OdM3y44oJZe
s+RA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=fdMoftu7pqRBAMuQL6xZytcp+QJvwVkWDZxQFiiA60Q=;
b=TSSoHzeKqv4ZOeWbUcO6MTxPNpFJlSDm1CC1P9OuULeMG/SDR9eqnAbv+MsmzOvu9i
XXknMeWToTnXDJpGr3tMwQ/vCSrjamLDnSRzTs/hlMP3x2Nm3YeLALd6jI4Zi9x73uPe
OJVDbuLfFmMmXRrY479slxQxXI+9MGMc4oeVmPOQij2MJ62AY/brKs+lhNDN6ljJV/kS
zsbf8i4NXIBjwNzJX1XlEkSOGEZ1c1CNic3XtZf6hRywspZ5Y1I+tYLVbhObbB9xdGt/
IZnxypd+/S1p6MqgcpkD4i1RKHJIhtwdMp+kY8e0Zhh7jy/2h8cS3Z6pmW0ie2jcXS9w
MTTg==
X-Gm-Message-State: AOAM533qTPvZT6oUx5zefQu3NiNsg0exS8Cop4BJHWR7t+Uc7sigBD2V
xvKayqiHF1kOrrZJx15uVPCs0RxQk7YrCx0qsYqqID61
X-Google-Smtp-Source: ABdhPJzXLyE3gH7BolnYxTEYWpGVsLc7O+469U3+xcAJKnu20l11BaedNI+r3zkfv4NvqYTO71SgyCPgljiX7t7OhVs=
X-Received: by 2002:a9d:7995:: with SMTP id h21mr3241782otm.174.1593425264445;
Mon, 29 Jun 2020 03:07:44 -0700 (PDT)
In-Reply-To: <5613F080-14DE-4562-BDA1-FD439C9FBF5D@gnu.org>
Received-SPF: pass client-ip=2607:f8b0:4864:20::32e;
envelope-from=p.stephani2@gmail.com; helo=mail-ot1-x32e.google.com
X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache.
That's all we know.
X-Spam_score_int: -17
X-Spam_score: -1.8
X-Spam_bar: -
X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
the Swiss army knife of text editors"
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org
Original-Sender: "bug-gnu-emacs"
Xref: news.gmane.io gmane.emacs.bugs:182518
Archived-At:
Am Mo., 29. Juni 2020 um 11:39 Uhr schrieb Eli Zaretskii :
>
> On June 29, 2020 11:33:45 AM GMT+03:00, Philipp Stephani wrote:
> > Am So., 28. Juni 2020 um 23:53 Uhr schrieb Erik Hetzner :
> > >
> > > 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?