summaryrefslogtreecommitdiff
path: root/simplejson/_speedups.c
diff options
context:
space:
mode:
authorBob Ippolito <bob@redivi.com>2014-06-24 11:49:26 -0700
committerBob Ippolito <bob@redivi.com>2014-06-24 11:49:26 -0700
commitb7486b82233ed2ec1a614dcf8944d376d12d04bf (patch)
treee8c2f1ae3d8544d9453bc2281e631d3a6b68fba7 /simplejson/_speedups.c
parenta19d53c1df389648b31619eda67cb178f8f00036 (diff)
downloadsimplejson-b7486b82233ed2ec1a614dcf8944d376d12d04bf.tar.gz
Fix lower bound checking in scan_once / raw_decode API #98v3.5.3
Diffstat (limited to 'simplejson/_speedups.c')
-rw-r--r--simplejson/_speedups.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/simplejson/_speedups.c b/simplejson/_speedups.c
index 89ecafd..01614c4 100644
--- a/simplejson/_speedups.c
+++ b/simplejson/_speedups.c
@@ -2140,7 +2140,7 @@ scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *n
Py_ssize_t length = PyString_GET_SIZE(pystr);
PyObject *rval = NULL;
int fallthrough = 0;
- if (idx >= length) {
+ if (idx < 0 || idx >= length) {
raise_errmsg(ERR_EXPECTING_VALUE, pystr, idx);
return NULL;
}
@@ -2248,7 +2248,7 @@ scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_
Py_ssize_t length = PyUnicode_GetLength(pystr);
PyObject *rval = NULL;
int fallthrough = 0;
- if (idx >= length) {
+ if (idx < 0 || idx >= length) {
raise_errmsg(ERR_EXPECTING_VALUE, pystr, idx);
return NULL;
}