Message ID | moo0hv$s7d$1@ger.gmane.org |
---|---|
State | New |
Headers | show |
ping On 07/22/2015 01:58 PM, Stefan Liebler wrote: > Hi, > > i get the following build error on s390x building utf8_utf16-z9.c with > gcc 6: > In file included from ../include/sys/cdefs.h:3:0, > from ../include/features.h:365, > from ../dlfcn/dlfcn.h:22, > from ../include/dlfcn.h:2, > from ../sysdeps/s390/s390-64/utf8-utf16-z9.c:27: > ../iconv/skeleton.c: In function 'gconv': > ../sysdeps/s390/s390-64/utf8-utf16-z9.c:430:30: error: array subscript > is above array bounds [-Werror=array-bounds] > if (__glibc_unlikely (inptr + 2 > inend)) \ > ^ > ../misc/sys/cdefs.h:385:52: note: in definition of macro '__glibc_unlikely' > # define __glibc_unlikely(cond) __builtin_expect ((cond), 0) > ^ > ../iconv/loop.c:435:7: note: in expansion of macro 'BODY' > BODY > ^ > > While including loop.c to construct the SINGLE(LOOPFCT) method for > converting from UTF-16 to UTF-8, the bytebuf array with length > MAX_NEEDED_INPUT is used as inptr. MAX_NEEDED_INPUT defaults to > MIN_NEEDED_INPUT if not defined before including loop.c. > Thus bytebuf has a length of 2. > This patch defines MAX_NEEDED_INPUT to MAX_NEEDED_TO, which is 4. > > Ok for 2.22 or later? > > Bye > Stefan > > --- > 2015-07-22 Stefan Liebler <stli@linux.vnet.ibm.com> > > * sysdeps/s390/s390-64/utf8-utf16-z9.c > (MAX_NEEDED_INPUT): New define. > (MAX_NEEDED_OUTPUT): New define.
On Wed, Jul 22, 2015 at 01:58:54PM +0200, Stefan Liebler wrote: > While including loop.c to construct the SINGLE(LOOPFCT) method for > converting from UTF-16 to UTF-8, the bytebuf array with length > MAX_NEEDED_INPUT is used as inptr. MAX_NEEDED_INPUT defaults to > MIN_NEEDED_INPUT if not defined before including loop.c. > Thus bytebuf has a length of 2. > This patch defines MAX_NEEDED_INPUT to MAX_NEEDED_TO, which is 4. > > Ok for 2.22 or later? Looks good to me. I reckong it should be good for 2.22 as well given that it is a build failure, but Carlos has the last say on that as release manager so you'll have to wait a few hours for him to take a look at it. Siddhesh
diff --git a/sysdeps/s390/s390-64/utf8-utf16-z9.c b/sysdeps/s390/s390-64/utf8-utf16-z9.c index 1425cb1..6712c1c 100644 --- a/sysdeps/s390/s390-64/utf8-utf16-z9.c +++ b/sysdeps/s390/s390-64/utf8-utf16-z9.c @@ -183,6 +183,7 @@ gconv_end (struct __gconv_step *data) #define MIN_NEEDED_INPUT MIN_NEEDED_FROM #define MAX_NEEDED_INPUT MAX_NEEDED_FROM #define MIN_NEEDED_OUTPUT MIN_NEEDED_TO +#define MAX_NEEDED_OUTPUT MAX_NEEDED_TO #define LOOPFCT FROM_LOOP /* The software implementation is based on the code in gconv_simple.c. */ #define BODY \ @@ -340,6 +341,7 @@ gconv_end (struct __gconv_step *data) /* Conversion from UTF-16 to UTF-8. */ #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