Skip to contentSkip to conversation

lzma: ignore unset filesizes

PATCH New Mike Frysinger 2 participants 2 messages Dec 4, 2009 – Dec 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lzma: ignore unset filesizes

The Linux kernel build system changed how it compresses things with LZMA such that the header no longer contains the filesize (it is instead set to all F's). So if we get a LZMA image that has -1 for the 64bit field, let's just assume that the decompressed size is unknown and continue on.

---
 lib_generic/lzma/LzmaTools.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
lib_generic/lzma/LzmaTools.c +6 -3
index 408b577..8860bfb 100644
@@ -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);
Signature · 1 line
1.6.5.3
#1 lore raw

PATCH 1/1 lzma: ignore unset filesizes

Dear Mike Frysinger,

Quoted 9 lines · In message <[email protected]> you wrote:

The Linux kernel build system changed how it compresses things with LZMA such that the header no longer contains the filesize (it is instead set to all F's). So if we get a LZMA image that has -1 for the 64bit field, let's just assume that the decompressed size is unknown and continue on.

---
 lib_generic/lzma/LzmaTools.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Doubt is a pain too lonely to know that faith is his twin brother.
- Kahlil Gibran