mirror of
https://github.com/ianlancetaylor/libbacktrace.git
synced 2026-04-06 09:29:06 +08:00
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.
This commit is contained in:
2
elf.c
2
elf.c
@@ -5878,7 +5878,7 @@ elf_uncompress_lzma_block (const unsigned char *compressed,
|
|||||||
/* The byte at compressed[off] is ignored for some
|
/* The byte at compressed[off] is ignored for some
|
||||||
reason. */
|
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 + 2] << 16)
|
||||||
+ ((uint32_t)compressed[off + 3] << 8)
|
+ ((uint32_t)compressed[off + 3] << 8)
|
||||||
+ (uint32_t)compressed[off + 4]);
|
+ (uint32_t)compressed[off + 4]);
|
||||||
|
|||||||
Reference in New Issue
Block a user