From: Mark Wielaard Date: Tue, 22 Apr 2014 20:52:06 +0000 (+0200) Subject: libdwfl: __libdwfl_frame_reg_[gs]et use uint64_t when checking bits. X-Git-Tag: elfutils-0.159~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=740d1fe49758f28aad50b1d67b139a1564d73bbd;p=thirdparty%2Felfutils.git 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 --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index 1b2e13c35..f5ec36c43 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 dc99e40b6..18c808b28 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; }