From: Mark Wielaard Date: Tue, 1 Dec 2015 23:21:07 +0000 (+0100) Subject: libdw: Don't use a FDE if it doesn't actually cover a real code range. X-Git-Tag: elfutils-0.165~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e04da0e6bab6c6cca2d6e1657d18666f50d2ecfa;p=thirdparty%2Felfutils.git 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 --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index b176ade6f..738e2236d 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,8 @@ +2015-12-01 Mark Wielaard + + * fde.c (intern_fde): Don't intern an fde that doesn't cover a + valid code range. + 2015-12-01 Mark Wielaard * dwarf_end.c (dwarf_end): Call cu_free on fake_loc_cu if it exists. diff --git a/libdw/fde.c b/libdw/fde.c index c8475f3e6..2a59d3e12 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)