Commit d52a83a3 authored by Zackery Spytz's avatar Zackery Spytz Committed by Pablo Galindo

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

Use Py_ssize_t instead of int for i.
parent 7213df7b
...@@ -5377,7 +5377,7 @@ parse_file_actions(PyObject *file_actions, ...@@ -5377,7 +5377,7 @@ parse_file_actions(PyObject *file_actions,
return -1; 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); file_action = PySequence_Fast_GET_ITEM(seq, i);
Py_INCREF(file_action); Py_INCREF(file_action);
if (!PyTuple_Check(file_action) || !PyTuple_GET_SIZE(file_action)) { if (!PyTuple_Check(file_action) || !PyTuple_GET_SIZE(file_action)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment