]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdw/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 8 Oct 2012 21:34:35 +0000 (23:34 +0200)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Mon, 8 Oct 2012 21:34:35 +0000 (23:34 +0200)
fde.c (__libdw_find_fde): Change <fde != NULL> 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 <jan.kratochvil@redhat.com>
libdw/ChangeLog
libdw/fde.c

index cc45d5992738df7f341d312eb2832f63f381550b..0d2d5f11357a2fc3306582ad06cf7d6d3f5f3a81 100644 (file)
@@ -1,3 +1,9 @@
+2012-10-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * fde.c (__libdw_find_fde): Change <fde != NULL> 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  <jan.kratochvil@redhat.com>
 
        * dwarf_getlocation.c (__libdw_intern_expression) <cfap>: Make new
index bde0c99239edb53db8e6695147d1e41d3439e7d7..32c77b0d9b06b3a5c9a61d0f43c0da1fa7fcfae7 100644 (file)
@@ -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;
     }