From 740d1fe49758f28aad50b1d67b139a1564d73bbd Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 22 Apr 2014 22:52:06 +0200 Subject: libdwfl: __libdwfl_frame_reg_[gs]et use uint64_t when checking bits. Found by gcc -fsanitize=undefined while running the backtrace-core-ppc test. runtime error: shift exponent 45 is too large for 32-bit type 'unsigned int' Signed-off-by: Mark Wielaard --- libdwfl/ChangeLog | 6 ++++++ libdwfl/frame_unwind.c | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 1b2e13c3..f5ec36c4 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,3 +1,9 @@ +2014-04-22 Mark Wielaard + + * frame_unwind.c (__libdwfl_frame_reg_get): Use uint64_t when + checking bits. + (__libdwfl_frame_reg_set): Likewise. + 2014-04-22 Kurt Roeckx * linux-pid-attach.c: Make linux only. diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c index dc99e40b..18c808b2 100644 --- a/libdwfl/frame_unwind.c +++ b/libdwfl/frame_unwind.c @@ -57,7 +57,7 @@ __libdwfl_frame_reg_get (Dwfl_Frame *state, unsigned regno, Dwarf_Addr *val) if (regno >= ebl_frame_nregs (ebl)) return false; if ((state->regs_set[regno / sizeof (*state->regs_set) / 8] - & (1U << (regno % (sizeof (*state->regs_set) * 8)))) == 0) + & ((uint64_t) 1U << (regno % (sizeof (*state->regs_set) * 8)))) == 0) return false; if (val) *val = state->regs[regno]; @@ -77,7 +77,7 @@ __libdwfl_frame_reg_set (Dwfl_Frame *state, unsigned regno, Dwarf_Addr val) if (ebl_get_elfclass (ebl) == ELFCLASS32) val &= 0xffffffff; state->regs_set[regno / sizeof (*state->regs_set) / 8] |= - (1U << (regno % (sizeof (*state->regs_set) * 8))); + ((uint64_t) 1U << (regno % (sizeof (*state->regs_set) * 8))); state->regs[regno] = val; return true; } -- cgit v1.2.1