diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-07 04:48:24 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-07 04:48:24 (GMT) |
commit | 60da31660c6a74fea15dfc93f3b3c16ce4619539 (patch) | |
tree | b95ea57e737ea98604e9b8401edcf50968f0dee7 /Modules/_hotshot.c | |
parent | e22373d69011e719aa92837822e9a35157e20e8c (diff) | |
download | cpython-60da31660c6a74fea15dfc93f3b3c16ce4619539.zip cpython-60da31660c6a74fea15dfc93f3b3c16ce4619539.tar.gz cpython-60da31660c6a74fea15dfc93f3b3c16ce4619539.tar.bz2 |
Thanks to Coverity, these were all reported by their Prevent tool.
All of these (except _lsprof.c) should be backported. Particularly
the hotshot change which validates sys.path. Can someone backport?
Diffstat (limited to 'Modules/_hotshot.c')
-rw-r--r-- | Modules/_hotshot.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c index 162a319..64dfa91 100644 --- a/Modules/_hotshot.c +++ b/Modules/_hotshot.c @@ -473,6 +473,8 @@ restart: } else if (!err) { result = PyTuple_New(4); + if (result == NULL) + return NULL; PyTuple_SET_ITEM(result, 0, PyInt_FromLong(what)); PyTuple_SET_ITEM(result, 2, PyInt_FromLong(fileno)); if (s1 == NULL) @@ -1455,6 +1457,10 @@ write_header(ProfilerObject *self) getcwd(cwdbuffer, sizeof cwdbuffer)); temp = PySys_GetObject("path"); + if (temp == NULL || !PyList_Check(temp)) { + PyErr_SetString(PyExc_RuntimeError, "sys.path must be a list"); + return -1; + } len = PyList_GET_SIZE(temp); for (i = 0; i < len; ++i) { PyObject *item = PyList_GET_ITEM(temp, i); |