]> granicus.if.org Git - python/commitdiff
bpo-37419: Fix possible segfaults when passing large sequences to os.posix_spawn...
authorZackery Spytz <zspytz@gmail.com>
Wed, 26 Jun 2019 20:54:20 +0000 (14:54 -0600)
committerPablo Galindo <Pablogsal@gmail.com>
Wed, 26 Jun 2019 20:54:19 +0000 (21:54 +0100)
Use Py_ssize_t instead of int for i.

Modules/posixmodule.c

index 5134ed7bdf44915f77ca3b4580c7e67268c782ff..5f17fce1a717caa59c4cce9f3889ed027d2d7578 100644 (file)
@@ -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)) {