]> git.ipfire.org Git - thirdparty/glibc.git/commit
gconv: Fix assertion failure in ISO-2022-JP-3 module (bug 27256)
authorFlorian Weimer <fweimer@redhat.com>
Wed, 27 Jan 2021 12:36:12 +0000 (13:36 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Wed, 27 Jan 2021 13:39:48 +0000 (14:39 +0100)
commit79bf3c9774b0c2aa865b2ca397554ff425225d3c
treeed8c209ad85a277f2d2f9228ba230b251a4afc4b
parentd811d240c06a8191db88ad4f1e60e1b672e4cc66
gconv: Fix assertion failure in ISO-2022-JP-3 module (bug 27256)

The conversion loop to the internal encoding does not follow
the interface contract that __GCONV_FULL_OUTPUT is only returned
after the internal wchar_t buffer has been filled completely.  This
is enforced by the first of the two asserts in iconv/skeleton.c:

      /* We must run out of output buffer space in this
 rerun.  */
      assert (outbuf == outerr);
      assert (nstatus == __GCONV_FULL_OUTPUT);

This commit solves this issue by queuing a second wide character
which cannot be written immediately in the state variable, like
other converters already do (e.g., BIG5-HKSCS or TSCII).

Reported-by: Tavis Ormandy <taviso@gmail.com>
(cherry picked from commit 7d88c6142c6efc160c0ee5e4f85cde382c072888)
iconvdata/Makefile
iconvdata/bug-iconv14.c [new file with mode: 0644]
iconvdata/iso-2022-jp-3.c