diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2004-08-13 03:18:29 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2004-08-13 03:18:29 (GMT) |
commit | f076953eb13caf629c81c3656cc0f178c7a91b1d (patch) | |
tree | 0a433a11cc30bd1ef3cd9bc1d7b026ee88a29235 /Objects | |
parent | 39689c5c6a2a3f1a9135d62b427032a3c4eae053 (diff) | |
download | cpython-f076953eb13caf629c81c3656cc0f178c7a91b1d.zip cpython-f076953eb13caf629c81c3656cc0f178c7a91b1d.tar.gz cpython-f076953eb13caf629c81c3656cc0f178c7a91b1d.tar.bz2 |
SF patch #1005778, Fix seg fault if list object is modified during list.index()
Backport candidate
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/listobject.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c index e5d5b25..89cedc9 100644 --- a/Objects/listobject.c +++ b/Objects/listobject.c @@ -2186,9 +2186,7 @@ listindex(PyListObject *self, PyObject *args) if (stop < 0) stop = 0; } - else if (stop > self->ob_size) - stop = self->ob_size; - for (i = start; i < stop; i++) { + for (i = start; i < stop && i < self->ob_size; i++) { int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); if (cmp > 0) return PyInt_FromLong((long)i); |