classification
Title: Interpreter crashes on invalid arg to spawnl on Windows
Type: crash Stage: needs patch
Components: Library (Lib) Versions: Python 3.3, Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: alfps, amaury.forgeotdarc, brian.curtin, dstanek, exarkun, ezio.melotti, ggenellina, haypo, loewis, nvetoshkin, schmir, terry.reedy
Priority: high Keywords: patch

Created on 2010-03-01 21:12 by alfps, last changed 2011-10-26 19:30 by nvetoshkin.

Files
File name Uploaded Description Edit
issue8036_0.patch nvetoshkin, 2011-03-11 12:54
issue_8036_1.patch nvetoshkin, 2011-10-26 19:30 args checking + tests review
Messages (14)
msg100272 - (view) Author: Alf P. Steinbach (alfps) Date: 2010-03-01 21:12
In Windows XP, using CPython 3.1.1:

python -c "import os; os.spawnl( os.P_WAIT, 'blah' )"

Crashes the interpreter and Windows pops up the "tell us about it" box.


Python 2.6 is however happy and just reports invalid arg.
msg100281 - (view) Author: Brian Curtin (brian.curtin) * (Python committer) Date: 2010-03-01 23:57
Confirmed on trunk, release31-maint, and py3k on Windows. OS X returns 127 in that case.
msg100699 - (view) Author: Gabriel Genellina (ggenellina) Date: 2010-03-09 05:48
In case it matters, 3.0.1 does NOT crash.
msg100718 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-03-09 13:22
2.6 and 3.0.1 used to disable the Microsoft CRT argument error handler: they return EINVAL, but newer versions don't, and should check their arguments before calling _spawnv.

FWIW, the checks are::
    pathname != NULL
    *pathname != '\0'
    argv != NULL
    *argv != NULL
    **argv != '\0'
The first and third checks are guaranteed by the implementation, but the other three should be done in posix_spawnv().
And the other calls to the various nt.spawn* functions probably suffer the same problem.
msg100720 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2010-03-09 14:13
Why is the Microsoft CRT argument error handler no longer disabled?
msg100721 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-03-09 14:24
Because this is a global setting for the whole process. This was discussed with issue4804.
msg127123 - (view) Author: David Stanek (dstanek) Date: 2011-01-26 17:39
Should this just be resolved as a "won't fix"?
msg127124 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2011-01-26 17:43
No, the issue can be fixed by better checking the arguments.
msg130563 - (view) Author: Vetoshkin Nikita (nvetoshkin) Date: 2011-03-11 12:54
Attached first attempt to close this issue. Are there enough checks? It passes:
os.spawnl(os.P_WAIT, '')
os.spawnl(os.P_WAIT, 'path')
os.spawnl(os.P_WAIT, 'path', '')
msg146327 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-10-24 22:15
This came up on python-list with
os.spawnl (os.P_NOWAIT, r"c:\windows\notepad.exe")
Tim Golden confirmed crash with Win7 on 2.7.?
I did same with 3.2.2 in both interpreter and from IDLE (IDLE hangs and then restarts after closing the 'pythonw has stopped' error message box).
Above apparently works in XP, at least with Py2.2.
msg146329 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2011-10-24 22:21
@nvetoshkin: Can you please also write tests (in Lib/test/test_os.py) for your patch?
msg146369 - (view) Author: Vetoshkin Nikita (nvetoshkin) Date: 2011-10-25 14:23
against py3k branch?
msg146370 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-10-25 14:27
Now we are using Mercurial, and what was called 'py3k' on SVN is now 'default'.  Since we now commit on older branches first and then merge with the most recent ones, the patch should either be against 3.2 or 2.7.
You can check the devguide for more informations.
msg146453 - (view) Author: Vetoshkin Nikita (nvetoshkin) Date: 2011-10-26 19:30
added some tests (not sure if in appropriate place).
History
Date User Action Args
2012-02-01 14:04:27pitroulinkissue13917 superseder
2011-10-26 19:30:34nvetoshkinsetfiles: + issue_8036_1.patch

messages: + msg146453
2011-10-25 14:27:15ezio.melottisetnosy: + ezio.melotti
messages: + msg146370
2011-10-25 14:23:47nvetoshkinsetmessages: + msg146369
2011-10-24 22:21:12hayposetmessages: + msg146329
2011-10-24 22:20:04hayposetnosy: + haypo
2011-10-24 22:15:05terry.reedysetnosy: + terry.reedy, loewis
messages: + msg146327
2011-06-12 22:21:10terry.reedysetversions: + Python 3.3, - Python 3.1
2011-03-11 12:54:01nvetoshkinsetfiles: + issue8036_0.patch

nosy: + nvetoshkin
messages: + msg130563

keywords: + patch
2011-02-24 15:58:11schmirsetnosy: + schmir
2011-01-26 17:43:41amaury.forgeotdarcsetnosy: exarkun, amaury.forgeotdarc, ggenellina, dstanek, brian.curtin, alfps
messages: + msg127124
2011-01-26 17:39:30dstaneksetnosy: + dstanek
messages: + msg127123
2010-03-09 14:24:58amaury.forgeotdarcsetmessages: + msg100721
2010-03-09 14:13:46exarkunsetnosy: + exarkun
messages: + msg100720
2010-03-09 13:22:52amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg100718
2010-03-09 05:48:07ggenellinasetnosy: + ggenellina
messages: + msg100699
2010-03-01 23:58:00brian.curtinsetpriority: high


title: Interpreter crashes on invalid arg to spawnl (Windows XP) -> Interpreter crashes on invalid arg to spawnl on Windows
nosy: + brian.curtin
versions: + Python 2.7, Python 3.2
messages: + msg100281
stage: needs patch
2010-03-01 21:12:27alfpscreate