Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
S390: Fix build error with gcc6 in utf8_utf16-z9.c.
This patch fixes the build error with gcc6:
array subscript is above array bounds [-Werror=array-bounds]

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.

ChangeLog:

	* sysdeps/s390/s390-64/utf8-utf16-z9.c
	(MAX_NEEDED_INPUT): New define.
	(MAX_NEEDED_OUTPUT): New define.
  • Loading branch information
Stefan Liebler authored and Andreas Krebbel committed Aug 26, 2015
1 parent 1efad39 commit 808d702
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ChangeLog
@@ -1,3 +1,9 @@
2015-08-26 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.

2015-08-26 Stefan Liebler <stli@linux.vnet.ibm.com>

* NEWS: New item for IBM z13 string optimizations.
Expand Down
2 changes: 2 additions & 0 deletions sysdeps/s390/s390-64/utf8-utf16-z9.c
Expand Up @@ -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 \
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 808d702

Please sign in to comment.