[Python-checkins] cpython (2.7): avoid reading unallocated memory when argc == 0 (closes #22633)

benjamin.peterson python-checkins at python.org
Sat Feb 14 21:17:52 CET 2015


https://hg.python.org/cpython/rev/687b970c8ba9
changeset:   94612:687b970c8ba9
branch:      2.7
parent:      94599:a4a3a8b3f37f
user:        Benjamin Peterson <benjamin at python.org>
date:        Sat Feb 14 15:17:25 2015 -0500
summary:
  avoid reading unallocated memory when argc == 0 (closes #22633)

files:
  Python/frozenmain.c |  3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/Python/frozenmain.c b/Python/frozenmain.c
--- a/Python/frozenmain.c
+++ b/Python/frozenmain.c
@@ -35,7 +35,8 @@
 #ifdef MS_WINDOWS
     PyInitFrozenExtensions();
 #endif /* MS_WINDOWS */
-    Py_SetProgramName(argv[0]);
+    if (argc >= 1)
+        Py_SetProgramName(argv[0]);
     Py_Initialize();
 #ifdef MS_WINDOWS
     PyWinFreeze_ExeInit();

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list