Fix readelf so it doesn't complain about corrupt attribute.
authorCary Coutant <ccoutant@google.com>
Tue, 11 Feb 2014 19:33:49 +0000 (11:33 -0800)
committerCary Coutant <ccoutant@google.com>
Tue, 11 Feb 2014 19:33:49 +0000 (11:33 -0800)
When a DW_FORM_flag_present attribute comes at the very end of a
debug section, readelf complains about a corrupt attribute
because it's checking to make sure there's at least one byte of
data remaining. This patch suppresses the check when the form
is DW_FORM_flag_present.

2014-02-11  Cary Coutant  <ccoutant@google.com>

* binutils/dwarf.c (read_and_display_attr_value): Don't warn
for zero-length attribute value.

binutils/ChangeLog
binutils/dwarf.c

index d7f5da1c8db974d8159a911f3870070e98c2ed06..7c258f6c719daac194731b43b2974d3bede7d727 100644 (file)
@@ -1,3 +1,8 @@
+2014-02-11  Cary Coutant  <ccoutant@google.com>
+
+       * binutils/dwarf.c (read_and_display_attr_value): Don't warn
+       for zero-length attribute value.
+
 2014-02-10  Alan Modra  <amodra@gmail.com>
 
        * po/binutils.pot: Regenerate.
index 1a62d9f9adba944c646f20c0258397984692c484..387504fc6303b1f17c872b4d06380fcd02f01c8c 100644 (file)
@@ -1468,7 +1468,7 @@ read_and_display_attr_value (unsigned long attribute,
   unsigned char * orig_data = data;
   unsigned int bytes_read;
 
-  if (data == end)
+  if (data == end && form != DW_FORM_flag_present)
     {
       warn (_("corrupt attribute\n"));
       return data;