aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2025-02-10 15:03:31 -0800
committerIan Lance Taylor <iant@golang.org>2025-02-10 15:03:31 -0800
commitd5c72da62d29cfa0fff532c66f28670c2dfcd75e (patch)
treef58736db2c73042993bd7260bba2aff6035a716b
parentd2ff1b78d70731db1b7adc1cbac7e44688828370 (diff)
downloadgcc-d5c72da62d29cfa0fff532c66f28670c2dfcd75e.zip
gcc-d5c72da62d29cfa0fff532c66f28670c2dfcd75e.tar.gz
gcc-d5c72da62d29cfa0fff532c66f28670c2dfcd75e.tar.bz2
libbacktrace: add cast to avoid undefined shift
Patch from pgerell@github. * elf.c (elf_uncompress_lzma_block): Add casts to avoid potentially shifting a value farther than its type size.
-rw-r--r--libbacktrace/elf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index d766fa4..868d0e1 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -5878,7 +5878,7 @@ elf_uncompress_lzma_block (const unsigned char *compressed,
/* The byte at compressed[off] is ignored for some
reason. */
- code = ((uint32_t)(compressed[off + 1] << 24)
+ code = (((uint32_t)compressed[off + 1] << 24)
+ ((uint32_t)compressed[off + 2] << 16)
+ ((uint32_t)compressed[off + 3] << 8)
+ (uint32_t)compressed[off + 4]);