summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Objects/typeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 45a229a..f05cf7c 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1067,7 +1067,8 @@ pmerge(PyObject *acc, PyObject* to_merge) {
}
for (j = 0; j < to_merge_size; j++) {
PyObject *j_lst = PyList_GET_ITEM(to_merge, j);
- if (PyList_GET_ITEM(j_lst, remain[j]) == candidate) {
+ if (remain[j] < PyList_GET_SIZE(j_lst) &&
+ PyList_GET_ITEM(j_lst, remain[j]) == candidate) {
remain[j]++;
}
}