Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* sparc-tdep.c: __builtin___memcpy_chk overflows destination buffer
@ 2009-09-17  2:36 Ralf Corsepius
  2009-09-17  6:25 ` Mark Kettenis
  2009-09-17 18:05 ` Jan Kratochvil
  0 siblings, 2 replies; 5+ messages in thread
From: Ralf Corsepius @ 2009-09-17  2:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Sherrill

[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]

Hi,

building gdb-6.8.91 for sparc-rtems* (sparc-elf) on F11/x86_64
raises this warning:

gcc -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions 
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -I. 
-I../../gdb-6.8.91/gdb -I../../gdb-6.8.91/gdb/common 
-I../../gdb-6.8.91/gdb/config 
-DLOCALEDIR="\"/opt/rtems-4.10/share/locale\"" -DHAVE_CONFIG_H 
-I../../gdb-6.8.91/gdb/../include/opcode  -I../bfd 
-I../../gdb-6.8.91/gdb/../bfd -I../../gdb-6.8.91/gdb/../include 
-I../libdecnumber -I../../gdb-6.8.91/gdb/../libdecnumber 
-I../../gdb-6.8.91/gdb/gnulib -Ignulib  -DMI_OUT=1 -DTUI=1   -Wall 
-Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral 
-Wno-pointer-sign -Wno-unused -Wno-switch -Wno-char-subscripts  -c -o 
sparc-tdep.o -MT sparc-tdep.o -MMD -MP -MF .deps/sparc-tdep.Tpo 
../../gdb-6.8.91/gdb/sparc-tdep.c
In file included from /usr/include/string.h:641,
                  from gnulib/string.h:24,
                  from ../../gdb-6.8.91/gdb/gdb_string.h:26,
                  from ../../gdb-6.8.91/gdb/vec.h:26,
                  from ../../gdb-6.8.91/gdb/breakpoint.h:26,
                  from ../../gdb-6.8.91/gdb/inferior.h:37,
                  from ../../gdb-6.8.91/gdb/sparc-tdep.c:32:
In function 'memcpy',
     inlined from 'sparc32_store_return_value' at 
../../gdb-6.8.91/gdb/sparc-tdep.c:1112,
     inlined from 'sparc32_return_value' at 
../../gdb-6.8.91/gdb/sparc-tdep.c:1170:
/usr/include/bits/string3.h:52: warning: call to __builtin___memcpy_chk 
will always overflow destination buffer

The patch below is what I am including into the rtems-gdb patches.

I don't have write access to gdb-cvs, and would appreciate it, if 
somebody else would apply the patch for me.

TIA,

	Ralf

[-- Attachment #2: sparc-gdb-6.8.91-gdb-sim.diff --]
[-- Type: text/plain, Size: 641 bytes --]

2009-09-17	Ralf Corsépius <ralf.corsepius@rtems.org>

	* sparc-tdep.c (sparc32_store_return_value): Use size_t as 
	return type of TYPE_LENGTH(type).


diff -Naur gdb-6.8.91.orig/gdb/sparc-tdep.c gdb-6.8.91/gdb/sparc-tdep.c
--- gdb-6.8.91.orig/gdb/sparc-tdep.c	2009-09-07 19:52:41.000000000 +0200
+++ gdb-6.8.91/gdb/sparc-tdep.c	2009-09-17 03:43:48.000000000 +0200
@@ -1100,7 +1100,7 @@
 sparc32_store_return_value (struct type *type, struct regcache *regcache,
 			    const gdb_byte *valbuf)
 {
-  int len = TYPE_LENGTH (type);
+  size_t len = TYPE_LENGTH (type);
   gdb_byte buf[8];
 
   gdb_assert (!sparc_structure_or_union_p (type));

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-09-18  5:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-17  2:36 sparc-tdep.c: __builtin___memcpy_chk overflows destination buffer Ralf Corsepius
2009-09-17  6:25 ` Mark Kettenis
2009-09-17 15:43   ` Joel Brobecker
2009-09-17 18:05 ` Jan Kratochvil
2009-09-18  5:01   ` Ralf Corsepius

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox