Author: Matti Picus <[email protected]>
Branch: unicode-utf8
Changeset: r95128:5437a5a4f8de
Date: 2018-09-16 21:22 +0300
http://bitbucket.org/pypy/pypy/changeset/5437a5a4f8de/

Log:    fix off-by-one

diff --git a/pypy/interpreter/unicodehelper.py 
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -1070,14 +1070,14 @@
         else:
             res_8, newindex = errorhandler(
                 errors, public_encoding_name, 'surrogates not allowed',
-                s, pos - 1, pos)
+                s, pos, pos+1)
             for cp in rutf8.Utf8StringIterator(res_8):
                 if cp < 0xD800:
                     _STORECHAR(result, cp, byteorder)
                 else:
                     errorhandler('strict', public_encoding_name,
                                  'surrogates not allowed',
-                                 s, pos-1, pos)
+                                 s, pos, pos+1)
             if index != newindex:  # Should be uncommon
                 index = newindex
                 pos = rutf8._pos_at_index(s, newindex)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to