Ticket #5908 (closed Bugs: fixed)
iostreams gzip fails to handle optional extra fields in gzip header
|Reported by:||Travis Abbott <typedef.struct@…>||Owned by:||turkanis|
|Milestone:||To Be Determined||Component:||iostreams|
When bit 2 (FEXTRA) is set in a gzip header's flags, the iostreams code fails to read the XLEN field before starting to read the extra comment. The code is actually there to do it, but it gets skipped. This means the code goes directly a loop like: while (--xlen != 0) with xlen still set to 0. This results in the rest of the file being slurped in by this comment reading code (or at least until xlen wraps around to 0 again, which could take awhile). I ran into this because many popular file formats in bioinformatics (BAM, tabix) are gzipped and include extra optional fields in their headers.
I've attached an example gzipped file with an optional header, a test program that should demonstrate the problem (against 1.47 and latest svn), as well as a patch that fixes it.