You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am working on an embedded project where RAM is very limited. The firmware update image is compressed (and encrypted with AES) using the Deflate algorithm. My embedded processor doesn't have enough RAM to uncompress the entire image so I need to do it piece mill using uzlib. When I attempt to make multiple calls to uzlib_uncompress it results in receiving a TINF_DATA_ERROR at some point before the end of the image has been reached.
To reproduce the exact scenario I did the following steps:
Create an image sufficiently large enough to trigger the error (I did 10000 bytes):
openssl rand -out orig.bin 10000
Modify tgzip to allow for creating a compressed image with only the compressed bytes:
Use the attached decomp.c example to try to decompress the above file: decomp.txt
Instructions for compiling it provided (I use WSL on Windows).
The goal is to decompress a series of bytes to feed into the firmware upgrade of another processor over a serial connection so each uzlib_uncompress call would be done before sending the uncompressed bytes over the serial connection.
Thank you for any help you can provide in troubleshooting what is going wrong.
From my actual image, you can see that with a buffer size of 128, I only get slightly into the 2nd call before it fails:
Thanks for the report. Unfortunately, currently I don't have time for the active uzlib maintenance. Sorry for the bot reply though, I made sure the ticket stays open until better times.
I have encountered the same issue. The challenge is the offset that is computed based on the table dist_base at the start of tinflate.c. This is an offset into the entire file indexing backwards from the current processed part. Thus, for small buffers it simply doesn't work. In the file that I use (generated by Linux gzip), the offset grows to nearly 0x8000 so the buffer needs to be at least this big.
In the example by @RyanLindemanCAE the buffer size is 128 but you can see already from the codelen offsets dump that there is a problem.
I have not yet figured out a way to make inflate work with smaller buffers, so any feedback is appreciated. I wonder if anything can be done on the compression side ? Any feedback is appreciated.
I am working on an embedded project where RAM is very limited. The firmware update image is compressed (and encrypted with AES) using the Deflate algorithm. My embedded processor doesn't have enough RAM to uncompress the entire image so I need to do it piece mill using uzlib. When I attempt to make multiple calls to uzlib_uncompress it results in receiving a TINF_DATA_ERROR at some point before the end of the image has been reached.
To reproduce the exact scenario I did the following steps:
openssl rand -out orig.bin 10000
./tgzip orig.bin compressed.bin
decomp.txt
Instructions for compiling it provided (I use WSL on Windows).
The goal is to decompress a series of bytes to feed into the firmware upgrade of another processor over a serial connection so each uzlib_uncompress call would be done before sending the uncompressed bytes over the serial connection.
Thank you for any help you can provide in troubleshooting what is going wrong.
From my actual image, you can see that with a buffer size of 128, I only get slightly into the 2nd call before it fails:
The failure appears to be this comparison:
offs > d->dest - d->destStart
The text was updated successfully, but these errors were encountered: