[Python-checkins] cpython (merge 3.6 -> default): 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/ba14f8b61bd8
changeset:   105156:ba14f8b61bd8
parent:      105153:9b053d3c74dc
parent:      105155:1369e51182b7
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Nov 16 16:13:13 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
@@ -11051,7 +11051,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