[coreboot] New patch to review for coreboot: 571fa2e libpayload: Don't do unaligned accesses during LZMA decompression

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Tue Mar 12 22:04:07 CET 2013

Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2670


commit 571fa2ec65e2de9afd57c22611144d13599ac91b
Author: Gabe Black <gabeblack at google.com>
Date:   Wed Mar 6 04:46:00 2013 -0800

    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 at google.com>
 payloads/libpayload/liblzma/lzma.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/payloads/libpayload/liblzma/lzma.c b/payloads/libpayload/liblzma/lzma.c
index 73c499a..0b97213 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;

More information about the coreboot mailing list