From patchwork Tue Jul 24 11:54:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 28581 Received: (qmail 103552 invoked by alias); 24 Jul 2018 11:54:46 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 103543 invoked by uid 89); 24 Jul 2018 11:54:45 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=labs, Key, HContent-Transfer-Encoding:8bit X-HELO: mx1.suse.de From: Andreas Schwab To: Jeff Law Cc: libc-alpha , Martin Sebor Subject: Re: Out out bounds array access in ibm iconv bits References: <4012c914-e051-3f6c-f604-555de0db8c69@redhat.com> X-Yow: HELLO, everybody, I'm a HUMAN!! Date: Tue, 24 Jul 2018 13:54:41 +0200 In-Reply-To: <4012c914-e051-3f6c-f604-555de0db8c69@redhat.com> (Jeff Law's message of "Mon, 23 Jul 2018 21:40:44 -0600") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 On Jul 23 2018, Jeff Law 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: Andreas. 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