[Python-checkins] bpo-37419: Fix possible segfaults when passing large sequences to os.posix_spawn() (GH-14409)

Pablo Galindo webhook-mailer at python.org
Wed Jun 26 16:54:32 EDT 2019


https://github.com/python/cpython/commit/d52a83a3d471ff3c7e9ebfa1731765e5334f7c24
commit: d52a83a3d471ff3c7e9ebfa1731765e5334f7c24
branch: master
author: Zackery Spytz <zspytz at gmail.com>
committer: Pablo Galindo <Pablogsal at gmail.com>
date: 2019-06-26T21:54:19+01:00
summary:

bpo-37419: Fix possible segfaults when passing large sequences to os.posix_spawn() (GH-14409)

Use Py_ssize_t instead of int for i.

files:
M Modules/posixmodule.c

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 5134ed7bdf44..5f17fce1a717 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -5377,7 +5377,7 @@ parse_file_actions(PyObject *file_actions,
         return -1;
     }
 
-    for (int i = 0; i < PySequence_Fast_GET_SIZE(seq); ++i) {
+    for (Py_ssize_t i = 0; i < PySequence_Fast_GET_SIZE(seq); ++i) {
         file_action = PySequence_Fast_GET_ITEM(seq, i);
         Py_INCREF(file_action);
         if (!PyTuple_Check(file_action) || !PyTuple_GET_SIZE(file_action)) {



More information about the Python-checkins mailing list