Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
29130474
Commit
29130474
authored
Nov 19, 2016
by
Steve Dower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28732: Fix crash in os.spawnv() with no elements in args
Prevents crashes in some other posixmodule.c functions
parent
5cb8ae34
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+16
-0
No files found.
Misc/NEWS
View file @
29130474
...
@@ -121,6 +121,8 @@ Core and Builtins
...
@@ -121,6 +121,8 @@ Core and Builtins
Library
Library
-------
-------
- Issue #28732: Fix crash in os.spawnv() with no elements in args
- Issue #28485: Always raise ValueError for negative
- Issue #28485: Always raise ValueError for negative
compileall.compile_dir(workers=...) parameter, even when multithreading is
compileall.compile_dir(workers=...) parameter, even when multithreading is
unavailable.
unavailable.
...
...
Modules/posixmodule.c
View file @
29130474
...
@@ -5186,6 +5186,16 @@ os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv)
...
@@ -5186,6 +5186,16 @@ os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv)
"spawnv() arg 2 must be a tuple or list"
);
"spawnv() arg 2 must be a tuple or list"
);
return
NULL
;
return
NULL
;
}
}
#ifdef MS_WINDOWS
/* Avoid changing behavior in maintenance release, but
the previous Windows behavior was to crash, so this
is a "compatible" improvement. */
if
(
argc
==
0
)
{
PyErr_SetString
(
PyExc_ValueError
,
"spawnv() arg 2 cannot be empty"
);
return
NULL
;
}
#endif
argvlist
=
PyMem_NEW
(
char
*
,
argc
+
1
);
argvlist
=
PyMem_NEW
(
char
*
,
argc
+
1
);
if
(
argvlist
==
NULL
)
{
if
(
argvlist
==
NULL
)
{
...
@@ -5207,7 +5217,9 @@ os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv)
...
@@ -5207,7 +5217,9 @@ os_spawnv_impl(PyObject *module, int mode, PyObject *path, PyObject *argv)
mode
=
_P_OVERLAY
;
mode
=
_P_OVERLAY
;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
spawnval
=
_spawnv
(
mode
,
path_char
,
argvlist
);
spawnval
=
_spawnv
(
mode
,
path_char
,
argvlist
);
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
free_string_array
(
argvlist
,
argc
);
free_string_array
(
argvlist
,
argc
);
...
@@ -5297,7 +5309,9 @@ os_spawnve_impl(PyObject *module, int mode, PyObject *path, PyObject *argv,
...
@@ -5297,7 +5309,9 @@ os_spawnve_impl(PyObject *module, int mode, PyObject *path, PyObject *argv,
mode
=
_P_OVERLAY
;
mode
=
_P_OVERLAY
;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
spawnval
=
_spawnve
(
mode
,
path_char
,
argvlist
,
envlist
);
spawnval
=
_spawnve
(
mode
,
path_char
,
argvlist
,
envlist
);
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
if
(
spawnval
==
-
1
)
if
(
spawnval
==
-
1
)
...
@@ -7022,7 +7036,9 @@ os_waitpid_impl(PyObject *module, Py_intptr_t pid, int options)
...
@@ -7022,7 +7036,9 @@ os_waitpid_impl(PyObject *module, Py_intptr_t pid, int options)
do
{
do
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
_Py_BEGIN_SUPPRESS_IPH
res
=
_cwait
(
&
status
,
pid
,
options
);
res
=
_cwait
(
&
status
,
pid
,
options
);
_Py_END_SUPPRESS_IPH
Py_END_ALLOW_THREADS
Py_END_ALLOW_THREADS
}
while
(
res
<
0
&&
errno
==
EINTR
&&
!
(
async_err
=
PyErr_CheckSignals
()));
}
while
(
res
<
0
&&
errno
==
EINTR
&&
!
(
async_err
=
PyErr_CheckSignals
()));
if
(
res
<
0
)
if
(
res
<
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment