Intermittent access violation using win32cred.CredRead
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
Issue is intermittent and may be difficult to reproduce.
Call win32cred.CredRead with a TargetName that does not exist. This will randomly cause Python to crash with an access violation.
I believe the root cause is that the variable "cred" in PyCredRead is not being initialized. If the call to CredRead fails it will not set cred to any value. Since cred is uninitialized there's a random chance the PyCredRead will call CredFree on an invalid address.
Initializing cred to NULL stopped the crash from occurring during my testing.
I believe I've started encountering this issue reliably in the keyring project test suite.
Running the test suite on Python 3.4, I get through many tests, then Python crashes here:
Running that test by itself, it will pass, but running it in the context of a full test suite run triggers the behavior, which re-inforces Dan's description implicating a prior call.
Using pywin32-ctypes does not exhibit the same behavior.
Just committed a fix for this.