diff options
author | Bob Ippolito <bob@redivi.com> | 2014-06-24 11:49:26 -0700 |
---|---|---|
committer | Bob Ippolito <bob@redivi.com> | 2014-06-24 11:49:26 -0700 |
commit | b7486b82233ed2ec1a614dcf8944d376d12d04bf (patch) | |
tree | e8c2f1ae3d8544d9453bc2281e631d3a6b68fba7 /simplejson/scanner.py | |
parent | a19d53c1df389648b31619eda67cb178f8f00036 (diff) | |
download | simplejson-b7486b82233ed2ec1a614dcf8944d376d12d04bf.tar.gz |
Fix lower bound checking in scan_once / raw_decode API #98v3.5.3
Diffstat (limited to 'simplejson/scanner.py')
-rw-r--r-- | simplejson/scanner.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/simplejson/scanner.py b/simplejson/scanner.py index b7918b3..5abed35 100644 --- a/simplejson/scanner.py +++ b/simplejson/scanner.py @@ -118,6 +118,11 @@ def py_make_scanner(context): raise JSONDecodeError(errmsg, string, idx) def scan_once(string, idx): + if idx < 0: + # Ensure the same behavior as the C speedup, otherwise + # this would work for *some* negative string indices due + # to the behavior of __getitem__ for strings. #98 + raise JSONDecodeError('Expecting value', string, idx) try: return _scan_once(string, idx) finally: |