This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Patch] PR java/29805, Write past end of array in java/typeck.c
- From: David Daney <ddaney at avtrex dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Sat, 11 Nov 2006 21:27:32 -0800
- Subject: [Patch] PR java/29805, Write past end of array in java/typeck.c
Under some circumstances we are writing past the end of an array in
java/typeck.c. On some targets (mipsel-linux-gnu) this causes the
compiler to ICE when compiling the newarray_overflow.java test from the
libjava testsuite.
Bootstrapped and regression tested on i686-pc-linux-gnu (trunk) and
mipsel-unknown-linux-gnu (4.2 branch) with no failures.
This gets me to zero FAILs for the libjava testsuite on
mipsel-linux-gnu. Yeah!
Since this is a regression from 3.4, OK for both 4.2 and the trunk?
2006-11-11 David Daney <ddaney@avtrex.com>
PR java/29805
* typeck.c (build_java_array_type): Increase buffer sizes.
Index: typeck.c
===================================================================
--- typeck.c (revision 118549)
+++ typeck.c (working copy)
@@ -356,7 +356,7 @@
build_java_array_type (tree element_type, HOST_WIDE_INT length)
{
tree sig, t, fld, atype, arfld;
- char buf[12];
+ char buf[23]; /* 20 for the digits of a 64 bit number + "[]" + \0 */
tree elsig = build_java_signature (element_type);
tree el_name = element_type;
buf[0] = '[';
@@ -379,7 +379,7 @@
if (TREE_CODE (el_name) == TYPE_DECL)
el_name = DECL_NAME (el_name);
{
- char suffix[12];
+ char suffix[23];
if (length >= 0)
sprintf (suffix, "[%d]", (int)length);
else