bpo-29774: Improve error reporting for corrupted extra field in ZIP f… · python/cpython@feccdb2 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit feccdb2
authored and
committed
bpo-29774: Improve error reporting for corrupted extra field in ZIP file. (#583)
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -438,7 +438,9 @@ def _decodeExtra(self): | ||
438 | 438 | unpack = struct.unpack |
439 | 439 | while len(extra) >= 4: |
440 | 440 | tp, ln = unpack('<HH', extra[:4]) |
441 | -if tp == 1: | |
441 | +if ln+4 > len(extra): | |
442 | +raise BadZipFile("Corrupt extra field %04x (size=%d)" % (tp, ln)) | |
443 | +if tp == 0x0001: | |
442 | 444 | if ln >= 24: |
443 | 445 | counts = unpack('<QQQ', extra[4:28]) |
444 | 446 | elif ln == 16: |