[Python-checkins] cpython: PyUnicode_FindChar() raises a IndexError on invalid index
victor.stinner
python-checkins at python.org
Sun Oct 2 01:14:20 CEST 2011
http://hg.python.org/cpython/rev/6bd6cc7f2c8d
changeset: 72579:6bd6cc7f2c8d
user: Victor Stinner <victor.stinner at haypocalc.com>
date: Sun Oct 02 01:08:37 2011 +0200
summary:
PyUnicode_FindChar() raises a IndexError on invalid index
files:
Objects/unicodeobject.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -8089,6 +8089,10 @@
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);
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list