[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#42113: 28.0.50; Segmentation fault in json-parse-file
From: |
Eli Zaretskii |
Subject: |
bug#42113: 28.0.50; Segmentation fault in json-parse-file |
Date: |
Mon, 29 Jun 2020 17:56:26 +0300 |
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Mon, 29 Jun 2020 12:07:33 +0200
> Cc: bug-gnu-emacs@gnu.org, Erik Hetzner <egh@e6h.org>, 42113@debbugs.gnu.org
>
> > > 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?
It is true that you could in principle write a coding-system that
would produce null bytes (although it wouldn't be very useful). But
in this case we are not talking about any arbitrary coding-system, we
are talking specifically about UTF-8.