Issue 8734: msvcrt get_osfhandle crash on bad FD (original) (raw)

Created on 2010-05-16 18:22 by pakal, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
msvcrt_crash2.patch pakal,2010-05-17 17:16
Messages (7)
msg105872 - (view) Author: Pascal Chambon (pakal) * Date: 2010-05-16 18:22
In python trunk, _set_invalid_parameter_handler() has been dropped and replaced by custom checking functions, but in msvcrt.get_osfhandle() these checks aren't present, so providing a bad FD leads to a crash. Here is the little fix + a test (added to test_fileio, because I can't find unit tests for the msvcrt builtin, and similar "bad fd" cases are treated there).
msg105908 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-05-17 15:09
I agree with the fix. However the patch should test for "sys.platform == 'win32'" before importing msvcrt. And there is an extra space on another line.
msg105917 - (view) Author: Pascal Chambon (pakal) * Date: 2010-05-17 17:16
My bad, here is a better patch...
msg105918 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-05-17 17:19
The second patch looks good to me.
msg115545 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-04 00:06
Should this be checked in?
msg115559 - (view) Author: Pascal Chambon (pakal) * Date: 2010-09-04 06:38
I guess it should, shouldn't it ?
msg115616 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-04 21:25
Ok, I've committed the patch in r84506 (3.x), r84507 (3.1) and r84508 (2.7). Thank you!
History
Date User Action Args
2022-04-11 14:57:01 admin set github: 52980
2010-09-04 21:25:50 pitrou set status: open -> closedresolution: accepted -> fixedmessages: + stage: commit review -> resolved
2010-09-04 06:38:19 pakal set messages: +
2010-09-04 00:06:10 pitrou set nosy: + pitroumessages: + versions: + Python 3.1, Python 3.2
2010-05-17 17:19:37 amaury.forgeotdarc set resolution: acceptedmessages: + stage: patch review -> commit review
2010-05-17 17:16:21 pakal set files: - msvcrt_crash.patch
2010-05-17 17:16:15 pakal set files: + msvcrt_crash2.patchmessages: +
2010-05-17 15:09:01 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: + stage: patch review
2010-05-16 18:22:11 pakal create