]> git.ipfire.org Git - thirdparty/glibc.git/commit
iconv: Fix incorrect UCS4 inner loop bounds (BZ#26923)
authorMichael Colavita <mcolavita@fb.com>
Thu, 19 Nov 2020 16:44:40 +0000 (11:44 -0500)
committerFangrui Song <i@maskray.me>
Sat, 28 Aug 2021 00:26:08 +0000 (17:26 -0700)
commit1a8e6a65626f17cb2547693a002b2877bebc8ddb
tree49330b611ff573fbf1a7aa530c5746b7871465c4
parentf1d716a048146099600d8fadb9d83a31c018dd6f
iconv: Fix incorrect UCS4 inner loop bounds (BZ#26923)

Previously, in UCS4 conversion routines we limit the number of
characters we examine to the minimum of the number of characters in the
input and the number of characters in the output. This is not the
correct behavior when __GCONV_IGNORE_ERRORS is set, as we do not consume
an output character when we skip a code unit. Instead, track the input
and output pointers and terminate the loop when either reaches its
limit.

This resolves assertion failures when resetting the input buffer in a step of
iconv, which assumes that the input will be fully consumed given sufficient
output space.
iconv/Makefile
iconv/gconv_simple.c
iconv/tst-iconv8.c [new file with mode: 0644]