Issue 12050: unconsumed_tail of zlib.Decompress is not always cleared on decompress() call (original) (raw)
Issue12050
Created on 2011-05-10 10:44 by Takeshi.Yoshino, last changed 2022-04-11 14:57 by admin. This issue is now closed.
| Messages (6) | ||
|---|---|---|
| msg135697 - (view) | Author: Takeshi Yoshino (Takeshi.Yoshino) | Date: 2011-05-10 10:44 |
| http://docs.python.org/library/zlib.html says "If max_length is not supplied then the whole input is decompressed, and unconsumed_tail is an empty string." However, if there's preceding decompress call with max_length specified, unconsumed_tail will not be empty. ---- import zlib c = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, zlib.DEFLATED, -zlib.MAX_WBITS) compressed = c.compress('abc') compressed += c.flush(zlib.Z_SYNC_FLUSH) d = zlib.decompressobj(-zlib.MAX_WBITS) original = d.decompress(data, 1) original += d.decompress(d.unconsumed_tail) print "%r" % d.unconsumed_tail ---- Result is ---- '\x06\x00\x00\x00\xff\xff' ---- Document or code should be fixed. | ||
| msg135723 - (view) | Author: Nadeem Vawda (nadeem.vawda) * ![]() |
Date: 2011-05-10 17:42 |
| Thanks for the bug report. It seems that the code needs fixing. I'll look into it this weekend. | ||
| msg135970 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2011-05-14 12:21 |
| New changeset 6a45567c7245 by Nadeem Vawda in branch '3.1': Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail http://hg.python.org/cpython/rev/6a45567c7245 New changeset 49c998a88777 by Nadeem Vawda in branch '3.2': Merge: #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail http://hg.python.org/cpython/rev/49c998a88777 New changeset 088e5d705171 by Nadeem Vawda in branch 'default': Merge: #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail http://hg.python.org/cpython/rev/088e5d705171 | ||
| msg135971 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2011-05-14 12:29 |
| New changeset 24543f7a87ce by Nadeem Vawda in branch '2.7': Issue #12050: zlib.decompressobj().decompress() now clears the unconsumed_tail http://hg.python.org/cpython/rev/24543f7a87ce | ||
| msg135972 - (view) | Author: Nadeem Vawda (nadeem.vawda) * ![]() |
Date: 2011-05-14 12:36 |
| The code has been fixed. Once again, thanks for the bug report. | ||
| msg136141 - (view) | Author: Takeshi Yoshino (Takeshi.Yoshino) | Date: 2011-05-17 04:33 |
| Thank you for the fix! |
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:57:17 | admin | set | github: 56259 |
| 2011-05-17 04:33:06 | Takeshi.Yoshino | set | messages: + |
| 2011-05-14 12:36:38 | nadeem.vawda | set | status: open -> closedresolution: fixedmessages: + stage: needs patch -> resolved |
| 2011-05-14 12:29:57 | python-dev | set | messages: + |
| 2011-05-14 12:21:43 | python-dev | set | nosy: + python-devmessages: + |
| 2011-05-11 19:27:20 | jcea | set | nosy: + jcea |
| 2011-05-10 17:42:30 | nadeem.vawda | set | versions: + Python 3.1, Python 2.7, Python 3.2, Python 3.3, - Python 2.6nosy: + nadeem.vawdamessages: + assignee: nadeem.vawdastage: needs patch |
| 2011-05-10 10:44:13 | Takeshi.Yoshino | create |

