Opened 10 years ago

Last modified 6 years ago

#7810 new Bugs

zlib_error::check throws on Z_BUF_ERROR

Reported by: m.hekkelman@… Owned by: Jonathan Turkanis
Milestone: To Be Determined Component: iostreams
Version: Boost 1.52.0 Severity: Problem
Keywords: Cc:

Description

zlib_error::check has a line that checks for Z_BUF_ERROR but it is commented out. Now the documentation for zlib states that Z_BUF_ERROR is not a fatal error and so I think the commented code should actually be activated since it now happens to me that io::zlib_decompressor fails on one of my files.

Change History (3)

comment:1 by m.hekkelman@…, 10 years ago

Although I do believe the iostreams zlib wrapper code might run into problems, further investigation of my own code that triggered this report revealed that the file I was testing was truncated... duh. My bad, should have checked that first of course.

The problem here is the error code returned by zlib (Z_BUF_ERROR) which is a bit ambiguous.

The way the code is written in iostreams zlib wrapper might still throw an exception in a case where this is inappropriate. Working around this would need a kind of rainy day fund approach where a temp buffer should be used to expand remaining bytes in the zlib buffer.

comment:2 by Ibrahim Gokhan YANIKLAR <ibrahim.yaniklar@…>, 7 years ago

This fix recovers Z_BUF_ERROR conditions successfully.

https://github.com/boostorg/iostreams/pull/17

comment:3 by Edward Diener, 6 years ago

The fix causes problems with gzip so it has been backed out. A Z_BUF_ERROR throws an exception which the end-user should be prepared to catch so as to retry the zlib compression or decompression as appropriate.

Note: See TracTickets for help on using tickets.