aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-03-22 13:25:22 +0000
committerNick Clifton <nickc@redhat.com>2016-03-22 13:25:22 +0000
commit34b9f7292f9c75d09c169a293c1f021eb97517ca (patch)
treeeb53c1c8d2066d4c9659b1bb31dc6f59b9e33f7a /binutils
parent4153b6dbb0f38a16fd5b583761aa811212fbb9a5 (diff)
downloadgdb-34b9f7292f9c75d09c169a293c1f021eb97517ca.zip
gdb-34b9f7292f9c75d09c169a293c1f021eb97517ca.tar.gz
gdb-34b9f7292f9c75d09c169a293c1f021eb97517ca.tar.bz2
Fix unbounded stack usage warning inside the SAFE_BYTE_GET macro.
PR 19851 binutils * dwarf.c (SAFE_BYTE_GET): Replace local dynamic array allocation with run time size check.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog4
-rw-r--r--binutils/dwarf.c7
2 files changed, 10 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0694a58..75d7170 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,5 +1,9 @@
2016-03-22 Nick Clifton <nickc@redhat.com>
+ PR 19851
+ * dwarf.c (SAFE_BYTE_GET): Replace local dynamic array allocation
+ with run time size check.
+
* configure: Regenerate.
2016-03-21 Andrew Burgess <andrew.burgess@embecosm.com>
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 85d18f3..086df4b 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -317,8 +317,13 @@ read_uleb128 (unsigned char * data,
#define SAFE_BYTE_GET(VAL, PTR, AMOUNT, END) \
do \
{ \
- int dummy [sizeof (VAL) < (AMOUNT) ? -1 : 1] ATTRIBUTE_UNUSED ; \
unsigned int amount = (AMOUNT); \
+ if (sizeof (VAL) < amount) \
+ { \
+ error (_("internal error: attempt to read %d bytes of data in to %d sized variable"),\
+ amount, (int) sizeof (VAL)); \
+ amount = sizeof (VAL); \
+ } \
if (((PTR) + amount) >= (END)) \
{ \
if ((PTR) < (END)) \