This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Out out bounds array access in ibm iconv bits
- From: Andreas Schwab <schwab at suse dot de>
- To: Jeff Law <law at redhat dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>, Martin Sebor <msebor at gmail dot com>
- Date: Tue, 24 Jul 2018 13:54:41 +0200
- Subject: Re: Out out bounds array access in ibm iconv bits
- References: <4012c914-e051-3f6c-f604-555de0db8c69@redhat.com>
On Jul 23 2018, Jeff Law <law@redhat.com> wrote:
> So AFAICT this is a true error in the ibm iconv code spotted by Martin's
> improvements to the out of bounds array indexing warning on the gcc trunk.
>
> Building trunk glibc with a trunk gcc (any target AFAICT) on results in
> a warning like this:
>
> In file included from ibm1364.c:393,
> from ibm1390.c:35:
> ../iconv/skeleton.c: In function ‘gconv’:
> ../iconv/loop.c:446:274: error: array subscript 1 is outside array
> bounds of ‘unsigned char[4]’ [-Werror=array-bounds]
> BODY
I think this should fix it:
diff --git a/iconvdata/ibm1364.c b/iconvdata/ibm1364.c
index b833273aa8..9a40940ccf 100644
--- a/iconvdata/ibm1364.c
+++ b/iconvdata/ibm1364.c
@@ -296,6 +296,7 @@ enum
/* Next, define the other direction. */
#define MIN_NEEDED_INPUT MIN_NEEDED_TO
+#define MAX_NEEDED_INPUT MAX_NEEDED_TO
#define MIN_NEEDED_OUTPUT MIN_NEEDED_FROM
#define MAX_NEEDED_OUTPUT MAX_NEEDED_FROM
#define LOOPFCT TO_LOOP
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."