Closed ragkousism closed 6 years ago
Forgot to add the gzip in question
An obvious test is running this file thru the included "tgunzip" util. With the current master, 35e9c235da600cb562f71b73973eadd5ff45a04f, the result is the file of size 73080 with md5sum of 331c99fc2898a4f360a790d45989084d - the same as when decompressing with gunzip.
Apparently, your code has some bug. You would need to compare it with tgunzip's code and see what's wrong.
Hello @pfalcon yes I did try with tgunzip and it worked. The problem was not the code above. The code is correct. The issue is that before calling gzip_uncompress() the buffer I was writing the file, was 20 bytes sorter and as a result I was passing an invalid size to the library. The strange thing is that it didn't segfault on normal operation but only if I ran it with valgrind. Anyhow the case has nothing to do with the library. I am sorry for the inconvenience.
I have a gzip data array in C which has original size 73080 and compressed 34703. Based on your examples I wrote the following code to decompress the file
The problem is that one KB before the end, uzlib_uncompress exits with TINF_DONE and the crc check obviously fails. I wrote a test with exactly the same code on a smaller file and it woks without an issue. Is there some upper limit on the files the library can decompress? Any ideas what I am doing wrong?