diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-08 20:45:42 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-08 20:45:42 (GMT) |
commit | dec798eb46f7edfe0995ce1b8966097fb7567eb7 (patch) | |
tree | bb25a84c298781f53e8f0dee5323aacb254cc274 | |
parent | f6fd794fac1b6af754d233875c173afb5ca9c45e (diff) | |
download | cpython-dec798eb46f7edfe0995ce1b8966097fb7567eb7.zip cpython-dec798eb46f7edfe0995ce1b8966097fb7567eb7.tar.gz cpython-dec798eb46f7edfe0995ce1b8966097fb7567eb7.tar.bz2 |
Fix out of bound read in UTF-32 decoder on "narrow Unicode" builds.
-rw-r--r-- | Objects/unicodeobject.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index f8c738b..7cd0399 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3182,7 +3182,7 @@ PyUnicode_DecodeUTF32Stateful(const char *s, /* 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 |