glibc/iconv
Stefan Liebler 876cdf517d Avoid -Wstringop-overflow= warning in iconv module.
On s390x when compiling with GCC 12, I get this warning:
utf8-utf16-z9.c:
../iconv/loop.c: In function ‘__from_utf8_loop_etf3eh_single’:
../iconv/loop.c:445:22: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  445 |     bytebuf[inlen++] = *inptr++;
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~
../iconv/loop.c:381:17: note: at offset 4 into destination object ‘bytebuf’ of size 4
  381 |   unsigned char bytebuf[MAX_NEEDED_INPUT];
      |                 ^~~~~~~
../iconv/loop.c:445:22: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
  445 |     bytebuf[inlen++] = *inptr++;
      |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~
../iconv/loop.c:381:17: note: at offset 5 into destination object ‘bytebuf’ of size 4
  381 |   unsigned char bytebuf[MAX_NEEDED_INPUT];
      |                 ^~~~~~~

This patch tells the compiler that inend is always behind inptr which
avoids the warning.  Note that the SINGLE function is only used to
implement the mb*towc*() or wc*tomb*() functions.  Those functions use
inptr and inend pointing to a variable on stack, compute the inend pointer
or explicitly check the arguments which always leads to inptr < inend.

Special notes for backporters (according to Siddhesh Poyarekar):
If someone wants to backport this patch to release branches, they should
also backport the following wcrtomb change. Otherwise the assumptions
assumed by this patch are not true.

commit 9bcd12d223
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Fri May 13 19:10:15 2022 +0530

    wcrtomb: Make behavior POSIX compliant

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
2022-06-14 11:03:06 +02:00
..
Makefile build: Properly generate .d dependency files [BZ #28922] 2022-02-25 10:35:45 -08:00
Versions intl: Handle translation output codesets with suffixes [BZ #26383] 2020-09-25 14:47:06 +02:00
dummy-repertoire.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_builtin.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_builtin.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_cache.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_charset.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_charset.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_close.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_conf.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_db.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_dl.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_int.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_open.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
gconv_parseconfdir.h iconv: Use 64 bit stat for gconv_parseconfdir (BZ# 29213) 2022-06-01 13:23:16 -03:00
gconv_simple.c Replace {u}int_fast{16|32} with {u}int32_t 2022-04-13 21:23:04 -05:00
gconv_trans.c Replace {u}int_fast{16|32} with {u}int32_t 2022-04-13 21:23:04 -05:00
iconv.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
iconv.h associate a deallocator for iconv_open 2022-03-14 20:02:49 +05:30
iconv_charmap.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
iconv_close.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
iconv_open.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
iconv_prog.c Update copyright dates not handled by scripts/update-copyrights. 2022-01-01 11:42:26 -08:00
iconv_prog.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
iconvconfig.c Update copyright dates not handled by scripts/update-copyrights. 2022-01-01 11:42:26 -08:00
iconvconfig.h Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
loop.c Avoid -Wstringop-overflow= warning in iconv module. 2022-06-14 11:03:06 +02:00
skeleton.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
strtab.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
test-gconv-modules Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-gconv-init-failure-mod.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-gconv-init-failure.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv-mt.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv-opt.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv1.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
tst-iconv2.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv3.c Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
tst-iconv4.c [BZ #9793] 2009-02-03 01:31:30 +00:00
tst-iconv5.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv6.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv7.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv8.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv9.c Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00
tst-iconv_prog.sh Update copyright dates with scripts/update-copyrights 2022-01-01 11:40:24 -08:00