summaryrefslogtreecommitdiffstats
path: root/src/readelf.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2015-04-22 12:47:46 +0200
committerMark Wielaard <[email protected]>2015-04-28 14:14:09 +0200
commit32d5b6f61a90b3c0c777b73eee973d6816a21294 (patch)
tree67b34b8ac760b51a0ca48193dff8919d4994c1bc /src/readelf.c
parent65a211f9028304757df8f4fa7cb3cc77d1501420 (diff)
readelf: Fix cie_offset calculation comparison on 32bit.
gcc -fsanitize=undefined pointed out that on 32bit systems the calculation to match the cie_offset to the cie_id could be undefined because a cie_id could be an unsigned 64bit value while ptrdiff_t is only 32bits. Correct the calculation to use 64bit values. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/readelf.c')
-rw-r--r--src/readelf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/readelf.c b/src/readelf.c
index 26c7eedb..b4cb3a82 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -5619,8 +5619,8 @@ print_debug_frame_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
struct cieinfo *cie = cies;
while (cie != NULL)
if (is_eh_frame
- ? start - (ptrdiff_t) cie_id == cie->cie_offset
- : (ptrdiff_t) cie_id == cie->cie_offset)
+ ? ((Dwarf_Off) start - cie_id) == (Dwarf_Off) cie->cie_offset
+ : cie_id == (Dwarf_Off) cie->cie_offset)
break;
else
cie = cie->next;