Message10495
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/jython_bug.py", line 4, in <module>
print repr(d.decompress(data[:1]))
File "/Users/cory/.pyenv/versions/jython-2.7.0/Lib/zlib.py", line 149, in decompress
string = _skip_gzip_header(string)
File "/Users/cory/.pyenv/versions/jython-2.7.0/Lib/zlib.py", 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()
'java1.8.0_66'
Operating System: Mac OS X 10.11.2 Beta |
|
Date |
User |
Action |
Args |
2015-11-23 10:38:23 | lukasa | set | recipients:
+ lukasa |
2015-11-23 10:38:23 | lukasa | set | messageid: <1448275103.94.0.547614448137.issue2433@psf.upfronthosting.co.za> |
2015-11-23 10:38:23 | lukasa | link | issue2433 messages |
2015-11-23 10:38:23 | lukasa | create | |
|