Author lukasa
Recipients lukasa
Date 2015-11-23.10:38:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When using the zlib module's decompressobj with a negative wbits value (e.g. missing the compressed stream headers), if a sufficiently small amount of data is fed to the decoder for the first chunk, an IndexError will be thrown.

Sample Code:

    import zlib
    data = b'\xcb\xc8T(\xc9H-J\x05\x00'
    d = zlib.decompressobj(-zlib.MAX_WBITS)
    print repr(d.decompress(data[:1]))

Expected result (and the result when using CPython 2.7.10 and PyPy 4.0.0:


Actual result:

    Traceback (most recent call last):
      File "/Users/cory/tmp/", line 4, in <module>
        print repr(d.decompress(data[:1]))
      File "/Users/cory/.pyenv/versions/jython-2.7.0/Lib/", line 149, in decompress
        string = _skip_gzip_header(string)
      File "/Users/cory/.pyenv/versions/jython-2.7.0/Lib/", line 231, in _skip_gzip_header
        id2 = s[1]
    IndexError: index out of range: 1

System Information:

>>> sys.version
'2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) \n[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)]'
>>> sys.getPlatform()

Operating System: Mac OS X 10.11.2 Beta
Date User Action Args
2015-11-23 10:38:23lukasasetrecipients: + lukasa
2015-11-23 10:38:23lukasasetmessageid: <>
2015-11-23 10:38:23lukasalinkissue2433 messages
2015-11-23 10:38:23lukasacreate