New submission from Oleg Oshmyan <chor...@inbox.lv>: If a truncated input stream is given to the zlib.decompress function, it raises a zlib.error. However, if the same stream is fed to a zlib.Decompress object, no exception is raised during the entire lifetime of the object. Attached is an example demonstrating the discrepancy.
zlib.decompress raises this exception when it gets a Z_BUF_ERROR from zlib, while the implementation of zlib.Decompress.decompress just skips every Z_BUF_ERROR it gets as described in this (apparently inaccurate) comment: /* We will only get Z_BUF_ERROR if the output buffer was full but there wasn't more output when we tried again, so it is not an error condition. */ ---------- components: Extension Modules files: zlib-fail.py messages: 141257 nosy: chortos priority: normal severity: normal status: open title: zlib.Decompress.decompress/flush do not raise any exceptions when given truncated input streams type: behavior versions: Python 2.7, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file22777/zlib-fail.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12646> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com