[Python-checkins] cpython (3.2): Fix out of bound read in UTF-32 decoder on "narrow Unicode" builds.

serhiy.storchaka python-checkins at python.org
Tue Jan 8 21:47:19 CET 2013


http://hg.python.org/cpython/rev/bf347198fbaf
changeset:   81327:bf347198fbaf
branch:      3.2
parent:      81323:d5df9ed118c5
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Jan 08 22:45:42 2013 +0200
summary:
  Fix out of bound read in UTF-32 decoder on "narrow Unicode" builds.

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
@@ -3182,7 +3182,7 @@
     /* On narrow builds we split characters outside the BMP into two
        codepoints => count how much extra space we need. */
 #ifndef Py_UNICODE_WIDE
-    for (qq = q; qq < e; qq += 4)
+    for (qq = q; e - qq >= 4; qq += 4)
         if (qq[iorder[2]] != 0 || qq[iorder[3]] != 0)
             pairs++;
 #endif

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


More information about the Python-checkins mailing list