summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2015-09-03 17:15:03 (GMT)
committerBrett Cannon <brett@python.org>2015-09-03 17:15:03 (GMT)
commitdf6b544ff6f342e8a64056e627867a70413bfdb0 (patch)
treeba995c65afefd06ff9e890303d2fef6ed3fbe702 /Modules
parentb3d531348c40b195e6bb742d956ea749b3f7a969 (diff)
downloadcpython-df6b544ff6f342e8a64056e627867a70413bfdb0.zip
cpython-df6b544ff6f342e8a64056e627867a70413bfdb0.tar.gz
cpython-df6b544ff6f342e8a64056e627867a70413bfdb0.tar.bz2
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.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/_collectionsmodule.c b/Modules/_collectionsmodule.c
index 830c5b8..3856d83 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) {