diff options
| author | Stefano Babic <sbabic@denx.de> | 2013-09-13 12:04:54 +0200 |
|---|---|---|
| committer | Stefano Babic <sbabic@denx.de> | 2013-09-13 12:10:07 +0200 |
| commit | c4a7ece02046f647019cc0aaddf530833a8db29c (patch) | |
| tree | 06342cd9b8cc41b95442a992fb38a1bc8671b05c /lib/lzma/LzmaTools.c | |
| parent | b5e7f1bc4b899ea34e838d5d60b3e6f8e479d0a9 (diff) | |
| parent | 8386ca8bea7a6a8469c3b6a99313afb642e6cbeb (diff) | |
| download | olio-uboot-2014.01-c4a7ece02046f647019cc0aaddf530833a8db29c.tar.xz olio-uboot-2014.01-c4a7ece02046f647019cc0aaddf530833a8db29c.zip | |
Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts:
MAINTAINERS
boards.cfg
Signed-off-by: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'lib/lzma/LzmaTools.c')
| -rw-r--r-- | lib/lzma/LzmaTools.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/lzma/LzmaTools.c b/lib/lzma/LzmaTools.c index 8d1165e11b..0aec2f9c7 100644 --- a/lib/lzma/LzmaTools.c +++ b/lib/lzma/LzmaTools.c @@ -97,15 +97,19 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize, g_Alloc.Alloc = SzAlloc; g_Alloc.Free = SzFree; + /* Short-circuit early if we know the buffer can't hold the results. */ + if (outSizeFull != (SizeT)-1 && *uncompressedSize < outSizeFull) + return SZ_ERROR_OUTPUT_EOF; + /* Decompress */ - outProcessed = outSizeFull; + outProcessed = *uncompressedSize; WATCHDOG_RESET(); res = LzmaDecode( outStream, &outProcessed, inStream + LZMA_DATA_OFFSET, &compressedSize, - inStream, LZMA_PROPS_SIZE, LZMA_FINISH_ANY, &state, &g_Alloc); + inStream, LZMA_PROPS_SIZE, LZMA_FINISH_END, &state, &g_Alloc); *uncompressedSize = outProcessed; if (res != SZ_OK) { return res; |