charles2gan / charles2gan/firmware-mod-kit
uncramfs-lzma stops after successfully decoding the first block
- Dominant language
- C
- Stars
- 7
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
```
When processing a LZMA-compressed file, uncramfs-lzma stops after successfully
uncompressing the first file block.
As a consequence, files larger than the block size are truncated after the
first block (the rest of the file is filled with zeros).
I'm not sure how it was working so far, except when processing CramFS images
with only "small" files (i.e., files smaller than the LZMA block size).
The following patch should fix the problem:
--- a/lzma-uncramfs.c 2014-08-27 10:18:37.660841457 +0200
+++ b/lzma-uncramfs.c 2014-08-27 10:18:45.336841358 +0200
@@ -114,10 +114,6 @@
fprintf(stderr,"Uncompression failed");
return -1;
}
- else
- {
- return 0;
- }
}
return 0;
}
```
Original issue reported on code.google.com by `roberto.paleari@gmail.com` on 27 Aug 2014 at 8:23
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in lzma-uncramfs.c around the decompression loop and inspect the early return after the first successful block. Apply the issue's proposed control-flow change, then verify that a CramFS image containing a file larger than one LZMA block is fully extracted rather than truncated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100