diff options
author | Gabe Black <gabeblack@google.com> | 2013-03-06 04:46:00 -0800 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-03-13 23:42:09 +0100 |
commit | 00e5da6f25483f5d29aefadfff56a11dd0f3c97c (patch) | |
tree | eff3b2371dcd437bd18cf66819b9852ac108478f /payloads/libpayload/liblzma/lzma.c | |
parent | 903f8e03307de8a689244eec5bf9aface73850b1 (diff) |
libpayload: Don't do unaligned accesses during LZMA decompression
Use memcpy to access a uint32_t that's inherently unaligned due to the layout
of the LZMA header format.
Built and booted on Daisy and saw a data abort go away. Built and booted
into developer mode on Link and verified that bitmaps were
decompressed/displayed correctly.
Change-Id: Id3ae746c04d23bcb0345cb71797bfa219479cc8f
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2670
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'payloads/libpayload/liblzma/lzma.c')
-rw-r--r-- | payloads/libpayload/liblzma/lzma.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/payloads/libpayload/liblzma/lzma.c b/payloads/libpayload/liblzma/lzma.c index 73c499a826..0b97213070 100644 --- a/payloads/libpayload/liblzma/lzma.c +++ b/payloads/libpayload/liblzma/lzma.c @@ -26,7 +26,7 @@ unsigned long ulzma(const unsigned char * src, unsigned char * dst) unsigned char scratchpad[15980]; memcpy(properties, src, LZMA_PROPERTIES_SIZE); - outSize = *(UInt32 *)(src + LZMA_PROPERTIES_SIZE); + memcpy(&outSize, src + LZMA_PROPERTIES_SIZE, sizeof(outSize)); if (LzmaDecodeProperties(&state.Properties, properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK) { printf("lzma: Incorrect stream properties.\n"); return 0; |