Kaydet (Commit) 267aa243 authored tarafından Victor Stinner's avatar Victor Stinner

PyUnicode_FindChar() raises a IndexError on invalid index

üst bc603d12
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment