summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-10-01 23:08:37 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-10-01 23:08:37 (GMT)
commit267aa24365b9fe6b142be49a2db2219f14c456b7 (patch)
treec145ae95396519740e22b76b75ec697c8041e224 /Objects
parentbc603d12b7f7db959878068de65e623298a7eae3 (diff)
downloadcpython-267aa24365b9fe6b142be49a2db2219f14c456b7.zip
cpython-267aa24365b9fe6b142be49a2db2219f14c456b7.tar.gz
cpython-267aa24365b9fe6b142be49a2db2219f14c456b7.tar.bz2
PyUnicode_FindChar() raises a IndexError on invalid index
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index c0511ddc..ab77b03 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8089,6 +8089,10 @@ PyUnicode_FindChar(PyObject *str, Py_UCS4 ch,
int kind;
if (PyUnicode_READY(str) == -1)
return -2;
+ if (start < 0 || end < 0) {
+ PyErr_SetString(PyExc_IndexError, "string index out of range");
+ return -2;
+ }
if (end > PyUnicode_GET_LENGTH(str))
end = PyUnicode_GET_LENGTH(str);
kind = PyUnicode_KIND(str);