display_debug_str_offsets
authorAlan Modra <amodra@gmail.com>
Sat, 15 May 2021 05:45:47 +0000 (15:15 +0930)
committerAlan Modra <amodra@gmail.com>
Sat, 15 May 2021 05:46:35 +0000 (15:16 +0930)
* dwarf.c (display_debug_str_offsets): Constrain reads to length
given in header.

binutils/ChangeLog
binutils/dwarf.c

index 6d36f58a9c92cb60d489c44e79bdbf005506be9c..670ab977044ac30ec6af35c28b5b2e7d96af1cd8 100644 (file)
@@ -1,3 +1,8 @@
+2021-05-15  Alan Modra  <amodra@gmail.com>
+
+       * dwarf.c (display_debug_str_offsets): Constrain reads to length
+       given in header.
+
 2021-05-15  Alan Modra  <amodra@gmail.com>
 
        * dwarf.c (display_debug_aranges): Delete initial_length_size.
index cd76f3f5e839291c78c786c5efb27a041f5729de..a0b84fc8d851470a99696cf618d047215e2357af 100644 (file)
@@ -7480,12 +7480,12 @@ display_debug_str_offsets (struct dwarf_section *section,
            }
 
          int version;
-         SAFE_BYTE_GET_AND_INC (version, curr, 2, end);
+         SAFE_BYTE_GET_AND_INC (version, curr, 2, entries_end);
          if (version != 5)
            warn (_("Unexpected version number in str_offset header: %#x\n"), version);
 
          int padding;
-         SAFE_BYTE_GET_AND_INC (padding, curr, 2, end);
+         SAFE_BYTE_GET_AND_INC (padding, curr, 2, entries_end);
          if (padding != 0)
            warn (_("Unexpected value in str_offset header's padding field: %#x\n"), padding);