]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR27860, Segmentation fault on readelf -w
authorAlan Modra <amodra@gmail.com>
Thu, 13 May 2021 12:52:45 +0000 (22:22 +0930)
committerAlan Modra <amodra@gmail.com>
Thu, 13 May 2021 13:19:17 +0000 (22:49 +0930)
Well it didn't take long for the SAFE_BYTE_GET assert to trigger.

PR 27860
* dwarf.c (display_debug_frames): Sanity check cie_off before
attempting to read cie.

binutils/ChangeLog
binutils/dwarf.c

index 9f3099fcd76b53965c9df73a0292042fd99374ac..335c7d02fa81593bd99eae053039a7d5409677d3 100644 (file)
@@ -1,3 +1,9 @@
+2021-05-13  Alan Modra  <amodra@gmail.com>
+
+       PR 27860
+       * dwarf.c (display_debug_frames): Sanity check cie_off before
+       attempting to read cie.
+
 2021-05-12  Alan Modra  <amodra@gmail.com>
 
        * dwarf.c (process_extended_line_op): Don't bump data pointer past
index 56983e1c799c10e8d0affc4a1ddc8a24a956084b..20bd92657b319dae14889697af3762d49e57ea29 100644 (file)
@@ -8708,6 +8708,8 @@ display_debug_frames (struct dwarf_section *section,
                if (cie->chunk_start == look_for)
                  break;
            }
+         else if (cie_off >= section->size)
+           cie = NULL;
          else
            {
              for (cie = forward_refs; cie ; cie = cie->next)