summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2015-12-02 00:21:07 +0100
committerMark Wielaard <mjw@redhat.com>2015-12-02 00:27:14 +0100
commita8c515d0f576305007c94a4fc931a98d11abeada (patch)
tree4b3dc60eb8dacb4688154e9f097134b75bfe105c
parent0a96c93d895ad18cb475b1b19a231c047605c89b (diff)
downloadelfutils-a8c515d0f576305007c94a4fc931a98d11abeada.tar.gz
libdw: Don't use a FDE if it doesn't actually cover a real code range.
If the FDE end <= start then it doesn't actually cover a valid code range. Don't use and cache such FDEs (it will cause memory leaks if there is another FDE that has the same start address and a valid code range). Such FDEs have been seen in the backtrace.ppc.exec testfile. Signed-off-by: Mark Wielaard <mjw@redhat.com>
-rw-r--r--libdw/ChangeLog5
-rw-r--r--libdw/fde.c7
2 files changed, 12 insertions, 0 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index 81eeae61..10df13bd 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,10 @@
2015-12-01 Mark Wielaard <mjw@redhat.com>
+ * fde.c (intern_fde): Don't intern an fde that doesn't cover a
+ valid code range.
+
+2015-12-01 Mark Wielaard <mjw@redhat.com>
+
* dwarf_end.c (dwarf_end): Call cu_free on fake_loc_cu if it exists.
2015-10-19 Mark Wielaard <mjw@redhat.com>
diff --git a/libdw/fde.c b/libdw/fde.c
index c8475f3e..2a59d3e1 100644
--- a/libdw/fde.c
+++ b/libdw/fde.c
@@ -90,6 +90,13 @@ intern_fde (Dwarf_CFI *cache, const Dwarf_FDE *entry)
}
fde->end += fde->start;
+ /* Make sure the fde actually covers a real code range. */
+ if (fde->start >= fde->end)
+ {
+ free (fde);
+ return (void *) -1;
+ }
+
fde->cie = cie;
if (cie->sized_augmentation_data)