* [COMMITTED] libdwfl: Make sure to left shift a unsigned 64bit value in expr_eval.
@ 2019-04-28 11:34 Mark Wielaard
0 siblings, 0 replies; only message in thread
From: Mark Wielaard @ 2019-04-28 11:34 UTC (permalink / raw)
To: elfutils-devel; +Cc: Mark Wielaard
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 | 5 +++++
libdwfl/frame_unwind.c | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog
index 3e19d9bd1..7c9a018b8 100644
--- a/libdwfl/ChangeLog
+++ b/libdwfl/ChangeLog
@@ -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.
diff --git a/libdwfl/frame_unwind.c b/libdwfl/frame_unwind.c
index 8da691ee5..d7dfa5a94 100644
--- a/libdwfl/frame_unwind.c
+++ b/libdwfl/frame_unwind.c
@@ -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))
--
2.20.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-28 11:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-28 11:34 [COMMITTED] libdwfl: Make sure to left shift a unsigned 64bit value in expr_eval Mark Wielaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).