summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2015-06-25 23:22:36 -0700
committerPatrick Georgi <pgeorgi@google.com>2015-07-06 09:40:37 +0200
commitd8086876a74743db2191a62c5a75e344c907143f (patch)
treed1cc48918c98d136d22e1b966cd55f7953d31b3c
parente6883a3d9b198ccc9a2fc6d724f41e689aa6d1d6 (diff)
lzma: Return correct amount of decompressed bytes
The LZMA functions are supposed to return the decompressed size, but what they actually return is just an unaltered field from the LZMA header that is *supposed* to contain the decompressed size. Apparently some encoders just overshoot that for no good reason. This patch changes the code such that the actual amount of decompressed bytes is returned. BRANCH=smaug BUG=None TEST=Printed output bytes when decompressing kernels with LZMA in depthcharge, noted that amounts now make sense. Change-Id: Icdd8f782aa87841f770eff4c14a08973530c7446 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 24b2fa8c9a342ca4288dad1430c8965395f00263 Original-Change-Id: Ib4cf8673846aedd34656e594ce7b8ea875b56099 Original-Signed-off-by: Julius Werner <jwerner@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/282742 Original-Reviewed-by: Stefan Reinauer <reinauer@google.com> Original-Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-on: http://review.coreboot.org/10777 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
-rw-r--r--payloads/libpayload/liblzma/lzma.c2
-rw-r--r--src/lib/lzma.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/payloads/libpayload/liblzma/lzma.c b/payloads/libpayload/liblzma/lzma.c
index 23c95620ce..767eb8683c 100644
--- a/payloads/libpayload/liblzma/lzma.c
+++ b/payloads/libpayload/liblzma/lzma.c
@@ -48,7 +48,7 @@ unsigned long ulzman(const unsigned char *src, unsigned long srcn,
printf("lzma: Decoding error = %d\n", res);
return 0;
}
- return outSize;
+ return outProcessed;
}
unsigned long ulzma(const unsigned char *src, unsigned char *dst)
diff --git a/src/lib/lzma.c b/src/lib/lzma.c
index 89e4d97600..c04f4a4040 100644
--- a/src/lib/lzma.c
+++ b/src/lib/lzma.c
@@ -54,5 +54,5 @@ unsigned long ulzma(unsigned char * src, unsigned char * dst)
return 0;
}
timestamp_add_now(TS_END_ULZMA);
- return outSize;
+ return outProcessed;
}