Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Ralf Corsepius <ralf.corsepius@rtems.org>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Cc: Joel Sherrill <Joel.Sherrill@oarcorp.com>
Subject: sparc-tdep.c: __builtin___memcpy_chk overflows destination buffer
Date: Thu, 17 Sep 2009 02:36:00 -0000	[thread overview]
Message-ID: <4AB1A090.8030701@rtems.org> (raw)

[-- 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));

             reply	other threads:[~2009-09-17  2:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-17  2:36 Ralf Corsepius [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AB1A090.8030701@rtems.org \
    --to=ralf.corsepius@rtems.org \
    --cc=Joel.Sherrill@oarcorp.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox