[issue29739] zipfile raises wrong exception for some incorrect passwords

2017-06-18 Thread Jack Cushman
Jack Cushman added the comment: Agreed that no one should be using zip encryption. :) I hit this issue working on an academic exercise. I'm fine with closing this. (I do think the exception types in zipfile set up a trap for the programmer here: Python throws a different exception type

[issue29739] zipfile raises wrong exception for some incorrect passwords

2017-03-07 Thread Jack Cushman
Jack Cushman added the comment: Ah, thanks! That makes sense. I see it's documented in "man unzip" as well: "The correct password will always check out against the header, but there is a 1-in-256 chance that an incorrect password will as well. (This is a security f

[issue29739] zipfile raises wrong exception for some incorrect passwords

2017-03-06 Thread Jack Cushman
New submission from Jack Cushman: This bug arises when attempting to unzip a password-protected zipfile using the wrong password. Usually when zipfile extraction is attempted with an incorrect password, zipfile raise `RuntimeError("Bad password for file")`. But for a small