diff options
author | Brett Cannon <brett@python.org> | 2015-09-03 10:15:03 -0700 |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2015-09-03 10:15:03 -0700 |
commit | 2da1d4c26e3f69ec08200a0f915964be375dac8c (patch) | |
tree | 6d312a680b3b420fb45c63763b91d3660fa87bf1 /Modules | |
parent | 966460faa97264ff595fc320034b4e7a403c7d83 (diff) | |
download | cpython-2da1d4c26e3f69ec08200a0f915964be375dac8c.tar.gz |
Issue #24913: Fix overrun error in deque.index().
Reported by John Leitch and Bryce Darling, patch by Raymond Hettinger.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_collectionsmodule.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c index 830c5b83eb..3856d83fb4 100644 --- a/Modules/_collectionsmodule.c +++ b/Modules/_collectionsmodule.c @@ -924,6 +924,8 @@ deque_index(dequeobject *deque, PyObject *args) if (stop < 0) stop = 0; } + if (stop > Py_SIZE(deque)) + stop = Py_SIZE(deque); for (i=0 ; i<stop ; i++) { if (i >= start) { |