From 0034e33946824057b48c5e686a3aefc761b37384 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 10 Feb 2025 15:03:31 -0800 Subject: [PATCH] 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. --- elf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elf.c b/elf.c index 06084be..65e4cc4 100644 --- a/elf.c +++ b/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]);