[Python-checkins] r79096 - in python/trunk: Lib/test/test_os.py Misc/NEWS Modules/posixmodule.c

matthias.klose python-checkins at python.org
Fri Mar 19 15:45:06 CET 2010


Author: matthias.klose
Date: Fri Mar 19 15:45:06 2010
New Revision: 79096
Log:
- Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
Modified:
 python/trunk/Lib/test/test_os.py
 python/trunk/Misc/NEWS
 python/trunk/Modules/posixmodule.c
Modified: python/trunk/Lib/test/test_os.py
==============================================================================
--- python/trunk/Lib/test/test_os.py	(original)
+++ python/trunk/Lib/test/test_os.py	Fri Mar 19 15:45:06 2010
@@ -505,6 +505,9 @@
 except NotImplementedError:
 pass
 
+ def test_execvpe_with_bad_arglist(self):
+ self.assertRaises(ValueError, os.execvpe, 'notepad', [], None)
+
 class Win32ErrorTests(unittest.TestCase):
 def test_rename(self):
 self.assertRaises(WindowsError, os.rename, test_support.TESTFN, test_support.TESTFN+".bak")
Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Fri Mar 19 15:45:06 2010
@@ -63,6 +63,8 @@
 Extension Modules
 -----------------
 
+- Issue #1039, #8154: Fix os.execlp() crash with missing 2nd argument.
+
 - Issue #6949: Allow the _bsddb extension to be built with db-4.8.x.
 
 - Issue #8142: Update libffi to the 3.0.9 release.
Modified: python/trunk/Modules/posixmodule.c
==============================================================================
--- python/trunk/Modules/posixmodule.c	(original)
+++ python/trunk/Modules/posixmodule.c	Fri Mar 19 15:45:06 2010
@@ -2952,6 +2952,11 @@
 PyMem_Free(path);
 		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);
 	if (argvlist == NULL) {


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /