[Python-checkins] cpython: Check return value of PyList_Append() in Py_Main(). CID 1353200

christian.heimes python-checkins at python.org
Thu Sep 8 18:12:37 EDT 2016


https://hg.python.org/cpython/rev/cce7a59396d6
changeset:   103366:cce7a59396d6
user:        Christian Heimes <christian at python.org>
date:        Fri Sep 09 00:08:35 2016 +0200
summary:
  Check return value of PyList_Append() in Py_Main(). CID 1353200

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


diff --git a/Modules/main.c b/Modules/main.c
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -482,7 +482,8 @@
             warning_option = PyUnicode_FromWideChar(_PyOS_optarg, -1);
             if (warning_option == NULL)
                 Py_FatalError("failure in handling of -W argument");
-            PyList_Append(warning_options, warning_option);
+            if (PyList_Append(warning_options, warning_option) == -1)
+                Py_FatalError("failure in handling of -W argument");
             Py_DECREF(warning_option);
             break;
 

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


More information about the Python-checkins mailing list