diff options
author | Guido van Rossum <guido@python.org> | 2002-12-31 16:33:01 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2002-12-31 16:33:01 (GMT) |
commit | 768158c11b0ad571b7e6c9337aa39bae4b3958e3 (patch) | |
tree | ec42746126e98e2894328e9093cb079ab3a5893e /Objects | |
parent | e29310a2b3e50958b00c0e92b142992599cf7ef1 (diff) | |
download | cpython-768158c11b0ad571b7e6c9337aa39bae4b3958e3.zip cpython-768158c11b0ad571b7e6c9337aa39bae4b3958e3.tar.gz cpython-768158c11b0ad571b7e6c9337aa39bae4b3958e3.tar.bz2 |
Fix an out-of-bound index in pmerge() discovered by Zooko (SF bug
645404). I'm not 100% sure this is the right fix, so I'll keep the
bug report open for Samuele, but this fixes the index error and passes
the test suite (and I can't see why it *shouldn't* be the right fix
:-).
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/typeobject.c | 3 |
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]++; } } |