
This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.
Created on2017-01-30 17:30 byRazerM, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.
| Messages (7) | |||
|---|---|---|---|
| msg286495 -(view) | Author: Frazer McLean (RazerM)* | Date: 2017-01-30 17:30 | |
On 3.5.2 and 3.5.3, but not 3.4.3 or 2.7.10 (Windows 64-bit), the third line causes Python to crash with exit code 0xC0000417.import msvcrtfp = open('file.txt', 'w')msvcrt.locking(fp.fileno(), msvcrt.LK_NBLCK, -1)print('End')I came across this in the portalocker module. I don't think -1 is a valid third argument, but it doesn't raise an exception on Python 3.4 or 2.7. | |||
| msg286500 -(view) | Author: Frazer McLean (RazerM)* | Date: 2017-01-30 23:09 | |
I ran it on AppVeyor to double check, the crash appears from 3.5 onwards as I saw on my computer.https://ci.appveyor.com/project/RazerM/issue29392/build/3 | |||
| msg286501 -(view) | Author: Eryk Sun (eryksun)*![]() | Date: 2017-01-30 23:40 | |
The old CRT doesn't do any parameter validation on the nbytes parameter. It just passes it directly to Windows LockFile as follows: LockFile((HANDLE)_get_osfhandle(fh), lockoffset, 0L, nbytes, 0L)which is locking (DWORD)-1 bytes, i.e. 0xFFFFFFFF. This allows users to sneakily lock more than 2 GiB by passing a negative value. Python could do its own validation in 2.7 to raise an exception for negative values, but I think it's too late; that ship has sailed. The parameter is validated by the new CRT in 3.5+, which limits nbytes to non-negative values. There we need the _Py_BEGIN_SUPPRESS_IPH and _Py_END_SUPPRESS_IPH macros to handle the failed call without crashing the process. | |||
| msg287003 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2017-02-04 23:06 | |
New changesetf48bdcd02b57 by Steve Dower in branch '3.5':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://hg.python.org/cpython/rev/f48bdcd02b57New changeset15bbb18d87fd by Steve Dower in branch '3.6':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://hg.python.org/cpython/rev/15bbb18d87fdNew changesetfb6a48fa8da3 by Steve Dower in branch 'default':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://hg.python.org/cpython/rev/fb6a48fa8da3 | |||
| msg287012 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2017-02-05 00:00 | |
New changesetcb0c9718f7bd13df67b0d7df88b6f5b197ef05a7 by Steve Dower in branch '3.5':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://github.com/python/cpython/commit/cb0c9718f7bd13df67b0d7df88b6f5b197ef05a7 | |||
| msg287016 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2017-02-05 00:00 | |
New changesetcb0c9718f7bd13df67b0d7df88b6f5b197ef05a7 by Steve Dower in branch 'master':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://github.com/python/cpython/commit/cb0c9718f7bd13df67b0d7df88b6f5b197ef05a7New changeseted8b523b9f6495806a38262ca9d1676bf7d5e830 by Steve Dower in branch 'master':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://github.com/python/cpython/commit/ed8b523b9f6495806a38262ca9d1676bf7d5e830New changeset01c3bdbb25068e7558ff8f275d0ed22c9f4e6b32 by Steve Dower in branch 'master':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://github.com/python/cpython/commit/01c3bdbb25068e7558ff8f275d0ed22c9f4e6b32 | |||
| msg287021 -(view) | Author: Roundup Robot (python-dev)![]() | Date: 2017-02-05 00:00 | |
New changeseted8b523b9f6495806a38262ca9d1676bf7d5e830 by Steve Dower in branch '3.6':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://github.com/python/cpython/commit/ed8b523b9f6495806a38262ca9d1676bf7d5e830New changesetcb0c9718f7bd13df67b0d7df88b6f5b197ef05a7 by Steve Dower in branch '3.6':Issue#29392: Prevent crash when passing invalid arguments into msvcrt module.https://github.com/python/cpython/commit/cb0c9718f7bd13df67b0d7df88b6f5b197ef05a7 | |||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:42 | admin | set | github: 73578 |
| 2018-05-28 22:31:29 | steve.dower | set | status: open -> closed |
| 2017-02-05 00:00:34 | python-dev | set | messages: +msg287021 |
| 2017-02-05 00:00:31 | python-dev | set | messages: +msg287016 |
| 2017-02-05 00:00:29 | python-dev | set | messages: +msg287012 |
| 2017-02-04 23:06:23 | steve.dower | set | assignee:steve.dower resolution: fixed stage: needs patch -> resolved |
| 2017-02-04 23:06:04 | python-dev | set | nosy: +python-dev messages: +msg287003 |
| 2017-01-30 23:51:18 | eryksun | set | stage: needs patch versions: + Python 3.6, Python 3.7 |
| 2017-01-30 23:40:32 | eryksun | set | nosy: +eryksun messages: +msg286501 |
| 2017-01-30 23:09:43 | RazerM | set | messages: +msg286500 |
| 2017-01-30 17:30:26 | RazerM | create | |