From: Jan Kratochvil Date: Mon, 8 Oct 2012 21:34:35 +0000 (+0200) Subject: libdw/ X-Git-Tag: elfutils-0.156~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07f3507442cb3f913000844025ca139925afe110;p=thirdparty%2Felfutils.git libdw/ fde.c (__libdw_find_fde): Change to likely. Return DWARF_E_NO_MATCH if .eh_frame_hdr points to FDE which is too short for searched PC. Signed-off-by: Jan Kratochvil --- diff --git a/libdw/ChangeLog b/libdw/ChangeLog index cc45d5992..0d2d5f113 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,3 +1,9 @@ +2012-10-08 Jan Kratochvil + + * fde.c (__libdw_find_fde): Change to likely. Return + DWARF_E_NO_MATCH if .eh_frame_hdr points to FDE which is too short for + searched PC. + 2012-10-08 Jan Kratochvil * dwarf_getlocation.c (__libdw_intern_expression) : Make new diff --git a/libdw/fde.c b/libdw/fde.c index bde0c9923..32c77b0d9 100644 --- a/libdw/fde.c +++ b/libdw/fde.c @@ -229,12 +229,17 @@ __libdw_find_fde (Dwarf_CFI *cache, Dwarf_Addr address) if (offset == (Dwarf_Off) -1l) goto no_match; struct dwarf_fde *fde = __libdw_fde_by_offset (cache, offset); - if (unlikely (fde != NULL) - /* Sanity check the address range. */ - && unlikely (address < fde->start || address >= fde->end)) + if (likely (fde != NULL)) { - __libdw_seterrno (DWARF_E_INVALID_DWARF); - return NULL; + /* Sanity check the address range. */ + if (unlikely (address < fde->start)) + { + __libdw_seterrno (DWARF_E_INVALID_DWARF); + return NULL; + } + /* .eh_frame_hdr does not indicate length covered by FDE. */ + if (unlikely (address >= fde->end)) + goto no_match; } return fde; }