This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] SH: Fix buffer overrun


Hi,

On sh64-unknown-linux-gnu, the compilation of gcc.c-torture/
execute/20040709-2.c fails with segfault which seems to be
caused by buffer overrun.  The appended patch fixes it.
Tested on sh64-unknown-linux-gnu with no new failures.
Ok for mainline?

Regards,
	kaz
--
2005-06-08  Kaz Kojima  <kkojima@gcc.gnu.org>

	* config/sh/sh.md (mextr_rl): Set buffer size properly.
	(*mextr_lr): Likewise.

diff -uprN ORIG/gcc/gcc/config/sh/sh.md LOCAL/gcc/gcc/config/sh/sh.md
--- ORIG/gcc/gcc/config/sh/sh.md	Sun May 29 18:40:10 2005
+++ LOCAL/gcc/gcc/config/sh/sh.md	Wed Jun  8 09:21:29 2005
@@ -11613,7 +11613,7 @@ mov.l\\t1f,r0\\n\\
   "TARGET_SHMEDIA && INTVAL (operands[3]) + INTVAL (operands[4]) == 64"
   "*
 {
-  static char templ[16];
+  static char templ[24];
 
   sprintf (templ, \"mextr%d\\t%%N1, %%N2, %%0\",
 	   (int) INTVAL (operands[3]) >> 3);
@@ -11630,7 +11630,7 @@ mov.l\\t1f,r0\\n\\
   "TARGET_SHMEDIA && INTVAL (operands[3]) + INTVAL (operands[4]) == 64"
   "*
 {
-  static char templ[16];
+  static char templ[24];
 
   sprintf (templ, \"mextr%d\\t%%N2, %%N1, %%0\",
 	   (int) INTVAL (operands[4]) >> 3);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]