[New-bugs-announce] [issue24686] zipfile is intolerant of extra bytes

Devin Fisher report at bugs.python.org
Wed Jul 22 19:16:22 CEST 2015


New submission from Devin Fisher:

Not sure if this is a bug. The attached jar file is malformed.  Unzip (6.00) says the following about the malformedness of the jar file:

unzip -tqq bad.jar 
com/pixelmed/apps/DoseUtility$OurSourceDatabaseTreeBrowser$1.class bad extra-field entry:
      EF block length (43230 bytes) exceeds remaining EF data (10 bytes)


But unzip (6.00) and my GNOME Archive Manager (3.16.3) are able to open and extract the file without issue. 

So I'm wondering if zipfile is too strict?

Anyway, when trying to interact with attached jar file I get the following error.

Code:
import zipfile
if __name__ == "__main__":
    path = 'bad.jar'
    file = zipfile.ZipFile(path)

Output:
Traceback (most recent call last):
  File "/home/devin.fisher/sandboxes/feeder.v61_release.dev/temp/bug.py", line 4, in <module>
    file = zipfile.ZipFile(path)
  File "/usr/lib64/python3.4/zipfile.py", line 937, in __init__
    self._RealGetContents()
  File "/usr/lib64/python3.4/zipfile.py", line 1034, in _RealGetContents
    x._decodeExtra()
  File "/usr/lib64/python3.4/zipfile.py", line 418, in _decodeExtra
    counts = unpack('<QQQ', extra[4:28])
struct.error: unpack requires a bytes object of length 24

----------
components: Library (Lib)
files: bad.jar
messages: 247137
nosy: Devin Fisher
priority: normal
severity: normal
status: open
title: zipfile is intolerant of extra bytes
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file39983/bad.jar

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24686>
_______________________________________


More information about the New-bugs-announce mailing list