Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XZ decompression #4

Merged
merged 1 commit into from
Dec 12, 2024
Merged

Fix XZ decompression #4

merged 1 commit into from
Dec 12, 2024

Conversation

WallaceIT
Copy link
Contributor

Add a decompression buffer and some logic to fix XZ decompression.

Add a decompression buffer and some logic to fix XZ decompression.

Signed-off-by: Francesco Valla <[email protected]>
@WallaceIT
Copy link
Contributor Author

Hi! I tested this with a real-world BMAP file, but more testing is advised before merging.

While working on this, I noticed a potential flaw in the write approach (not only for xz but for the entire application): if an area of the source image is very large, this can lead to an excessive memory allocation for the write buffer. Of course, the meaning of "very large" here depends on the system it is used on. A better approah would probably be to split decompression (or read, in the case of no compresssion) in smaller chunks and then calculate the checksum in an incremental way.

@embetrix
Copy link
Owner

Fix #1

@embetrix embetrix merged commit b5b71a0 into embetrix:master Dec 12, 2024
2 checks passed
@embetrix
Copy link
Owner

embetrix commented Dec 12, 2024

@WallaceIT : thank you for the fix, I did some tests on my stm32mp1 with 512M and very large chuncks ~100MB, it went okay.
you are right that will be a good approach, more over I would to use libarchive instead of having both liblzma and zlib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants