aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-05-13 22:22:45 +0930
committerAlan Modra <amodra@gmail.com>2021-05-13 22:49:17 +0930
commitd21f875d6768aa1e5b8e5442c7e60b03307b1949 (patch)
treebe7f0621c1eb5b5816fd669e03aac29d3abbb9ef /binutils
parent0746f49b1dd44ce17b21468b9f8d9715e116a991 (diff)
downloadgdb-d21f875d6768aa1e5b8e5442c7e60b03307b1949.zip
gdb-d21f875d6768aa1e5b8e5442c7e60b03307b1949.tar.gz
gdb-d21f875d6768aa1e5b8e5442c7e60b03307b1949.tar.bz2
PR27860, Segmentation fault on readelf -w
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.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog6
-rw-r--r--binutils/dwarf.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 9f3099f..335c7d0 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index 56983e1..20bd926 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -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)