]> granicus.if.org Git - python/commitdiff
bpo-37419: Fix possible segfaults when passing large sequences to os.posix_spawn...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 26 Jun 2019 21:20:09 +0000 (14:20 -0700)
committerGitHub <noreply@github.com>
Wed, 26 Jun 2019 21:20:09 +0000 (14:20 -0700)
Use Py_ssize_t instead of int for i.
(cherry picked from commit d52a83a3d471ff3c7e9ebfa1731765e5334f7c24)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
Modules/posixmodule.c

index 2d68c9dbb478b38e08378341f1b5ccaa6383590e..70b15360a2bb1c478a2bf2b9783a1650103d05c5 100644 (file)
@@ -5380,7 +5380,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)) {