Out out bounds array access in ibm iconv bits
Andreas Schwab
schwab@suse.de
Tue Jul 24 11:54:00 GMT 2018
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."
More information about the Libc-alpha
mailing list