[Python-checkins] bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)

Victor Stinner webhook-mailer at python.org
Wed Sep 4 09:58:09 EDT 2019


https://github.com/python/cpython/commit/60bd1f88f21073965a444c8b39c4202d015da5d6
commit: 60bd1f88f21073965a444c8b39c4202d015da5d6
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2019-09-04T15:58:04+02:00
summary:

bpo-36030: Fix a possible segfault in PyTuple_New() (GH-15670)

files:
M Objects/tupleobject.c

diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 3419baa529a6..a72257f95b08 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -146,6 +146,9 @@ PyTuple_New(Py_ssize_t size)
     }
 #endif
     op = tuple_alloc(size);
+    if (op == NULL) {
+        return NULL;
+    }
     for (Py_ssize_t i = 0; i < size; i++) {
         op->ob_item[i] = NULL;
     }



More information about the Python-checkins mailing list