-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
zipfile: Seeking encrypted file breaks after seeking backwards #82515
Comments
Seeking back beyond the decrypted / unzipped buffer doesn't reset the decrypter's crc key values. All data read after seeking back beyond the buffer is garbled. |
Hi, I have another patch I would like to contribute to the zipfile module but would like to request a review of this one to minimise conflicts with later patches. If anyone is able to review the patch, I would really appreciate it :) Also, with regards to selecting Python versions for this issue, is there any rule of thumb I should be following? Thanks, |
PR 16937 is simpler. It does not change the decrypter. |
Thanks for looking at the PR. I got carried away refactoring the decrypter for a future scenario where there could be different decrypters (possibly using certificates too) :) Your PR is much simpler. Would you also be able to take a look at some other PRs I've submitted for zipfile. They are both pretty small changes: https://bugs.python.org/issue36993 Thanks again, |
I also think that the At the moment this state is set in 1) __init__ and 2) the seek method when seeking back beyond what is in the buffer. |
The decrypter was implemented with a generator for performance. The performance of decrypting is not critical, but this got us 2x speed up without complicating the code. See bpo-10030. If the support of other decrypters be added, they will likely be implemented in C in any case.
This is a different issue.
Thank you, they look good to me. I left just few comments. As for the original issue, I have doubts that backward seeking in a compressed file is a good idea. But this feature was added, and it worked with encrypted files if seek in the range of the buffer, so not working out of the range of the buffer is a bug which we should fix. |
Thanks for your help! Good point, I'll create a new change for the refactoring. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: