[Python-checkins] cpython (3.5): Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701).

serhiy.storchaka python-checkins at python.org
Wed Nov 16 09:13:28 EST 2016


https://hg.python.org/cpython/rev/b607f835f170
changeset:   105154:b607f835f170
branch:      3.5
parent:      105149:faf04a995031
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Nov 16 16:12:34 2016 +0200
summary:
  Fixed an off-by-one error in _PyUnicode_EqualToASCIIString (issue #28701).

files:
  Objects/unicodeobject.c |  2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10846,7 +10846,7 @@
     assert(p);
     for (i = 0; i < len; i++) {
         unsigned char c = (unsigned char)str[i];
-        if (c > 128 || p[i] != (wchar_t)c)
+        if (c >= 128 || p[i] != (wchar_t)c)
             return 0;
     }
     return 1;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list