[issue36736] Python crashes when calling win32file.LockFileEx
Eryk Sun
report at bugs.python.org
Sat Apr 27 10:25:47 EDT 2019
Eryk Sun <eryksun at gmail.com> added the comment:
> win32file.LockFileEx(h, win32con.LOCKFILE_EXCLUSIVE_LOCK, 5, 5, None)
This is a third-party issue in the PyWin32 package. win32file.LockFileEx shouldn't allow passing None for the required 5th parameter `ol` (i.e. the lpOverlapped parameter of WINAPI LockFileEx [1]). Or at least it should allocate a default overlapped record in this case, with the offset set to 0. Passing a NULL pointer leads to an access-violation exception.
[1]: https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-lockfileex
FYI, setting a lock on the file is unecessary in this case. You created the kernel file object without data-access sharing (i.e. shareMode == 0). Until the handle is closed, opening the file again with read or write data access will fail as a sharing violation (32).
----------
nosy: +eryksun
resolution: -> third party
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36736>
_______________________________________
More information about the Python-bugs-list
mailing list