You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zipfile's readline() drops data in universal newline mode #64247
The problem occurs when peek() is called on the boundary of the uncompress buffer and read() goes through more than one readbuffer. The result is that self._offset is smaller than len(chunk) leading to a non-sensical negative self._offset upon return from peek().
This problem does not seem to appear in 3.x since 028e8e0b03e8.
Activity
abalkin commentedon Dec 21, 2013
This problem happens when I unpack a file from a 200+ MB zip archive as follows:
I cannot reduce it to a test case suitable for posting here, but the culprit is the following code in zipfile.py:
See http://hg.python.org/cpython/file/81f8375e60ce/Lib/zipfile.py#l605
The problem occurs when peek() is called on the boundary of the uncompress buffer and read() goes through more than one readbuffer. The result is that self._offset is smaller than len(chunk) leading to a non-sensical negative self._offset upon return from peek().
This problem does not seem to appear in 3.x since 028e8e0b03e8.
serhiy-storchaka commentedon Dec 21, 2013
Does this patch fix a bug?
abalkin commentedon Dec 21, 2013
It does!
python-dev commentedon Dec 21, 2013
New changeset 8b097d07488d by Serhiy Storchaka in branch '2.7':
Issue bpo-20048: Fixed ZipExtFile.peek() when it is called on the boundary of
http://hg.python.org/cpython/rev/8b097d07488d
serhiy-storchaka commentedon Dec 21, 2013
Than you for your report and irrefragable analysis.