Issue36991
Created on 2019-05-21 12:26 by alter-bug-tracer, last changed 2019-09-12 14:33 by miss-islington.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| attr0.zip | alter-bug-tracer, 2019-05-21 12:26 | |||
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13632 | merged | berker.peksag, 2019-05-28 16:24 | |
| PR 16052 | merged | miss-islington, 2019-09-12 14:13 | |
| Messages (6) | |||
|---|---|---|---|
| msg343035 - (view) | Author: alter-bug-tracer (alter-bug-tracer) * | Date: 2019-05-21 12:26 | |
The following code throws an AttributeError when attempting to extract a malformed archive (attached):
import zipfile
import sys
zf = zipfile.ZipFile(sys.argv[1])
for info in zf.infolist():
zf.extract(info.filename)
Result:
Traceback (most recent call last):
File "code.py", line 6, in <module>
zf.extract(info.filename)
File "/usr/local/lib/python3.8/zipfile.py", line 1607, in extract
return self._extract_member(member, path, pwd)
File "/usr/local/lib/python3.8/zipfile.py", line 1677, in _extract_member
with self.open(member, pwd=pwd) as source, \
File "/usr/local/lib/python3.8/zipfile.py", line 1548, in open
return ZipExtFile(zef_file, mode, zinfo, zd, True)
File "/usr/local/lib/python3.8/zipfile.py", line 801, in __init__
self._decompressor = _get_decompressor(self._compress_type)
File "/usr/local/lib/python3.8/zipfile.py", line 708, in _get_decompressor
return bz2.BZ2Decompressor()
AttributeError: 'NoneType' object has no attribute 'BZ2Decompressor'
|
|||
| msg343154 - (view) | Author: Stéphane Wirtel (matrixise) * | Date: 2019-05-22 08:20 | |
Hi, Thank you for your report 1. but do you have the bz2 lib on your system, because without that, Python is not compiled with the support of this format. 2. your file seems to have an issue. unzip attr0.zip Archive: attr0.zip inflating: zipfile_extract.py error: invalid compressed data to inflate bad CRC 00000000 (should be 88075377) Please could you check again your compilation step and retry with an other file. I'm closing this issue. Thank you |
|||
| msg343155 - (view) | Author: Stéphane Wirtel (matrixise) * | Date: 2019-05-22 08:22 | |
I also recommend that you read this document about the compilation and installation of Python and its dependencies. https://devguide.python.org/setup/#compile-and-build Thank you |
|||
| msg343803 - (view) | Author: Berker Peksag (berker.peksag) * | Date: 2019-05-28 16:25 | |
The OP's report is valid and they already stated that the file is malformed. More importantly, this can be reproduced with a valid ZIP file as well. The correct behavior is to get RuntimeError in this case. _check_compression() needs to be called before _get_decompressor(). There is no issue when getting the compressor object because _check_compression() is called inside _writecheck(). |
|||
| msg352172 - (view) | Author: Gregory P. Smith (gregory.p.smith) * | Date: 2019-09-12 14:13 | |
New changeset 2f1b857562b0f1601c9019db74c29b7d7e21ac9f by Gregory P. Smith (Berker Peksag) in branch 'master': bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632) https://github.com/python/cpython/commit/2f1b857562b0f1601c9019db74c29b7d7e21ac9f |
|||
| msg352178 - (view) | Author: miss-islington (miss-islington) | Date: 2019-09-12 14:33 | |
New changeset 717cc61ed103684b8c73e0e8af10ace345f39f16 by Miss Islington (bot) in branch '3.8': bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632) https://github.com/python/cpython/commit/717cc61ed103684b8c73e0e8af10ace345f39f16 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-09-12 14:33:56 | miss-islington | set | nosy:
+ miss-islington messages: + msg352178 |
| 2019-09-12 14:13:56 | miss-islington | set | keywords:
+ patch pull_requests: + pull_request15674 |
| 2019-09-12 14:13:47 | gregory.p.smith | set | messages: + msg352172 |
| 2019-09-12 14:07:08 | gregory.p.smith | set | assignee: gregory.p.smith nosy:
+ gregory.p.smith |
| 2019-06-01 16:20:23 | berker.peksag | link | issue36992 superseder |
| 2019-05-28 16:25:32 | berker.peksag | set | status: closed -> open components: + Library (Lib) nosy:
+ berker.peksag, serhiy.storchaka |
| 2019-05-28 16:24:27 | berker.peksag | set | pull_requests: + pull_request13532 |
| 2019-05-22 08:22:27 | matrixise | set | messages: + msg343155 |
| 2019-05-22 08:20:22 | matrixise | set | status: open -> closed nosy:
+ matrixise resolution: not a bug |
| 2019-05-21 12:26:42 | alter-bug-tracer | create | |