]> git.sur5r.net Git - u-boot/blobdiff - lib_generic/lzma/LzmaTools.c
lzma: ignore unset filesizes
[u-boot] / lib_generic / lzma / LzmaTools.c
index c2a91e528dc8cd7178d170b772337575896d8845..8860bfbf3da0dd019104668491868d46f5a8be11 100644 (file)
@@ -36,6 +36,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <watchdog.h>
 
 #ifdef CONFIG_LZMA
 
@@ -60,7 +61,6 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
     ISzAlloc g_Alloc;
 
     SizeT outSizeFull = 0xFFFFFFFF; /* 4GBytes limit */
-    SizeT inProcessed;
     SizeT outProcessed;
     SizeT outSize;
     SizeT outSizeHigh;
@@ -97,11 +97,14 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
     } else if (outSizeHigh != 0 || (UInt32)(SizeT)outSize != outSize) {
         /*
          * SizeT is a 32 bit uint => We cannot manage files larger than
-         * 4GB!
+         * 4GB!  Assume however that all 0xf values is "unknown size" and
+         * not actually a file of 2^64 bits.
          *
          */
-        debug ("LZMA: 64bit support not enabled.\n");
-        return SZ_ERROR_DATA;
+        if (outSizeHigh != (SizeT)-1 || outSize != (SizeT)-1) {
+            debug ("LZMA: 64bit support not enabled.\n");
+            return SZ_ERROR_DATA;
+        }
     }
 
     debug ("LZMA: Uncompresed size............ 0x%lx\n", outSizeFull);
@@ -112,6 +115,9 @@ int lzmaBuffToBuffDecompress (unsigned char *outStream, SizeT *uncompressedSize,
 
     /* Decompress */
     outProcessed = outSizeFull;
+
+    WATCHDOG_RESET();
+
     res = LzmaDecode(
         outStream, &outProcessed,
         inStream + LZMA_DATA_OFFSET, &compressedSize,