#### Archived

This topic is now archived and is closed to further replies.

# [zlib] Z_BUF_ERROR on Inflate call

This topic is 5603 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I''m getting this error intermittently in my zip file reader. I cant seem to find the cause of it. In a winzip created zip file for example I get failures on file 32 of a 79 file archive, etc. There appears to me no pattern to the failures. I read in the FileHeader which gives me the compressed and uncompressed sizes. I pass those in to the zstream

z_stream stream;
stream.next_in = (Bytef*)CurrentLocation;
stream.next_out = (Bytef*)Buffer;
stream.zalloc = Z_NULL;
stream.zfree = Z_NULL;

I have also used winzip to confirm these two sizes were being read in correctly and it appears that my sizes match winzip. I just don''t get it. I''m sure I read the pkware spec correctly and I don''t get why I can get the first 30 files correctly but fail on the 31st. There is nothing wrong with the archive, winzip opens it fine, my library fails on other zip files at other random points as well. Is there any tricks I need to know about? I read some vague reference to need an extra byte or something in the decompression buffer... Many thanks, Chris

• 9
• 9
• 13
• 41
• 15