Discussion:
[Python-3000-checkins] r65148 - in python/branches/py3k: Modules/_json.c
benjamin.peterson
2008-07-19 22:26:35 UTC
Permalink
Author: benjamin.peterson
Date: Sun Jul 20 00:26:35 2008
New Revision: 65148

Log:
Merged revisions 65147 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk

........
r65147 | bob.ippolito | 2008-07-19 16:59:50 -0500 (Sat, 19 Jul 2008) | 1 line

#3322: bounds checking for _json.scanstring
........


Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Modules/_json.c

Modified: python/branches/py3k/Modules/_json.c
==============================================================================
--- python/branches/py3k/Modules/_json.c (original)
+++ python/branches/py3k/Modules/_json.c Sun Jul 20 00:26:35 2008
@@ -236,6 +236,10 @@
if (chunks == NULL) {
goto bail;
}
+ if (end < 0 || len <= end) {
+ PyErr_SetString(PyExc_ValueError, "end is out of bounds");
+ goto bail;
+ }
while (1) {
/* Find the end of the string or the next escape */
Py_UNICODE c = 0;
@@ -246,7 +250,7 @@
break;
}
else if (strict && c <= 0x1f) {
- raise_errmsg("Invalid control character at", pystr, begin);
+ raise_errmsg("Invalid control character at", pystr, next);
goto bail;
}
}
@@ -401,6 +405,10 @@
if (chunks == NULL) {
goto bail;
}
+ if (end < 0 || len <= end) {
+ PyErr_SetString(PyExc_ValueError, "end is out of bounds");
+ goto bail;
+ }
while (1) {
/* Find the end of the string or the next escape */
Py_UNICODE c = 0;
@@ -411,7 +419,7 @@
break;
}
else if (strict && c <= 0x1f) {
- raise_errmsg("Invalid control character at", pystr, begin);
+ raise_errmsg("Invalid control character at", pystr, next);
goto bail;
}
}

Loading...