summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2012-10-08 23:34:35 +0200
committerJan Kratochvil <jan.kratochvil@redhat.com>2012-10-08 23:34:35 +0200
commit07f3507442cb3f913000844025ca139925afe110 (patch)
tree0e91d37560891c8aca64be2df6d1cd423d932c33
parent96a9fc6ae246e2e03f9d82f136960691fa4a88fe (diff)
downloadelfutils-07f3507442cb3f913000844025ca139925afe110.tar.gz
libdw/
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>
-rw-r--r--libdw/ChangeLog6
-rw-r--r--libdw/fde.c15
2 files changed, 16 insertions, 5 deletions
diff --git a/libdw/ChangeLog b/libdw/ChangeLog
index cc45d599..0d2d5f11 100644
--- a/libdw/ChangeLog
+++ b/libdw/ChangeLog
@@ -1,5 +1,11 @@
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
loclist element DW_OP_call_frame_cfa before decoding the opcodes.
Remove the later DW_OP_call_frame_cfa push to RESULT.
diff --git a/libdw/fde.c b/libdw/fde.c
index bde0c992..32c77b0d 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;
}