0023-lzma-fixup.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From: Antonios Vamporakis <ant@area128.com>
  2. Date: Tue, 31 Dec 2013 01:05:42 +0100
  3. Subject: [PATCH] lzma: fix buffer bound check error
  4. Variable uncompressedSize references the space available, while outSizeFull is
  5. the actual expected uncompressed size. Using the wrong value causes LzmaDecode
  6. to return SZ_ERROR_INPUT_EOF. Problem was introduced in commit afca294. While
  7. at it add additional debug message.
  8. Signed-off-by: Antonios Vamporakis <ant@area128.com>
  9. CC: Kees Cook <keescook@chromium.org>
  10. CC: Simon Glass <sjg@chromium.org>
  11. CC: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
  12. CC: Luka Perkov <luka@openwrt.org>
  13. ---
  14. lib/lzma/LzmaTools.c | 5 ++++-
  15. 1 file changed, 4 insertions(+), 1 deletion(-)
  16. --- a/lib/lzma/LzmaTools.c
  17. +++ b/lib/lzma/LzmaTools.c
  18. @@ -102,7 +102,7 @@ int lzmaBuffToBuffDecompress (unsigned c
  19. return SZ_ERROR_OUTPUT_EOF;
  20. /* Decompress */
  21. - outProcessed = *uncompressedSize;
  22. + outProcessed = outSizeFull;
  23. WATCHDOG_RESET();
  24. @@ -111,6 +111,9 @@ int lzmaBuffToBuffDecompress (unsigned c
  25. inStream + LZMA_DATA_OFFSET, &compressedSize,
  26. inStream, LZMA_PROPS_SIZE, LZMA_FINISH_END, &state, &g_Alloc);
  27. *uncompressedSize = outProcessed;
  28. +
  29. + debug("LZMA: Uncompresed ................ 0x%zx\n", outProcessed);
  30. +
  31. if (res != SZ_OK) {
  32. return res;
  33. }