Merged revisions 79096 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79096 | matthias.klose | 2010-03-19 15:45:06 +0100 (Fr, 19 Mär 2010) | 2 lines

  - Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
........
This commit is contained in:
Matthias Klose 2010-03-20 02:13:49 +00:00
parent e0bc5dab99
commit b8022c8ad1
3 changed files with 10 additions and 0 deletions

View File

@ -511,6 +511,9 @@ class URandomTests (unittest.TestCase):
except NotImplementedError: except NotImplementedError:
pass pass
def test_execvpe_with_bad_arglist(self):
self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
class Win32ErrorTests(unittest.TestCase): class Win32ErrorTests(unittest.TestCase):
def test_rename(self): def test_rename(self):
self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak") self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak")

View File

@ -15,6 +15,8 @@ Core and Builtins
Library Library
------- -------
- Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
- Issue #4961: Inconsistent/wrong result of askyesno function in tkMessageBox - Issue #4961: Inconsistent/wrong result of askyesno function in tkMessageBox
with Tcl/Tk-8.5. with Tcl/Tk-8.5.

View File

@ -2979,6 +2979,11 @@ posix_execv(PyObject *self, PyObject *args)
PyMem_Free(path); PyMem_Free(path);
return NULL; return NULL;
} }
if (argc < 1) {
PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty");
PyMem_Free(path);
return NULL;
}
argvlist = PyMem_NEW(char *, argc+1); argvlist = PyMem_NEW(char *, argc+1);
if (argvlist == NULL) { if (argvlist == NULL) {