]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
libdwfl: Make sure to left shift a unsigned 64bit value in expr_eval.
authorMark Wielaard <mark@klomp.org>
Sun, 28 Apr 2019 11:29:53 +0000 (13:29 +0200)
committerMark Wielaard <mark@klomp.org>
Sun, 28 Apr 2019 11:33:44 +0000 (13:33 +0200)
In frame_unwind.c expr_eval we left shift 1 up to 56 bits. We have to
make sure we don't left shift a 32bit signed value (that would be
undefined behavior). So shift a 1ULL value instead.

Signed-off-by: Mark Wielaard <mark@klomp.org>
libdwfl/ChangeLog
libdwfl/frame_unwind.c

index 3e19d9bd1ebeb63651b1db1d6efa146b23380a02..7c9a018b855a2c09617294955b2e8878552c4b7b 100644 (file)
@@ -1,3 +1,8 @@
+2019-04-28  Mark Wielaard  <mark@klomp.org>
+
+       * frame_unwind.c (expr_eval): Make sure we left shift a unsigned
+       64bit value.
+
 2019-04-28  Mark Wielaard  <mark@klomp.org>
 
        * cu.c (addrarange): Only call realloc when naranges is not zero.
index 8da691ee5d00baf26ffc8b02888600bc8279f3cf..d7dfa5a94b660bcdaf2ca9506f5632efa35e3463 100644 (file)
@@ -336,7 +336,7 @@ expr_eval (Dwfl_Frame *state, Dwarf_Frame *frame, const Dwarf_Op *ops,
                val1 >>= (addr_bytes - op->number) * 8;
 #else
              if (op->number < 8)
-               val1 &= (1 << (op->number * 8)) - 1;
+               val1 &= (1ULL << (op->number * 8)) - 1;
 #endif
            }
          if (! push (val1))