Skip to content

bpo-38334: Fix seeking bug for encrypted zipfiles#16529

Closed
danifus wants to merge 4 commits into
python:mainfrom
danifus:bpo-38334
Closed

bpo-38334: Fix seeking bug for encrypted zipfiles#16529
danifus wants to merge 4 commits into
python:mainfrom
danifus:bpo-38334

Conversation

@danifus

@danifus danifus commented Oct 2, 2019

Copy link
Copy Markdown
Contributor

This resolves an issue where seeking on an encrypted zipfile would cause the crc keys to go out of sync resulting in bad data to be read after the seek.

https://bugs.python.org/issue38334

This centralises the logic for initialising the decompressor and
decrypter when 1. opening the file and 2. seeking backwards in a file
stream.
This commit resolves an issue where seeking on an encrypted zipfile
would cause the crc keys to go out of sync resulting in data read after
the seek to be garbled.

This commit refactors `_ZipDecrypter` to be a class (`CRCZipDecrypter`)
that can be reinitialised when seeking back to the beginning of a zipped
file. In doing so, some of the logic relating to configuring the
decrypter which was found in `ZipFile` has been moved to the decrypter
class.
@danifus

danifus commented Jun 1, 2021

Copy link
Copy Markdown
Contributor Author

Fixed by #16937

@danifus danifus closed this Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants