From: Serhiy Storchaka Date: Mon, 21 Jan 2013 09:42:57 +0000 (+0200) Subject: Issue #16335: Fix integer overflow in unicode-escape decoder. X-Git-Tag: v3.3.1rc1~322 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c35f3a9f619d0d4abd43d16ddc4767e2a30c3dce;p=python Issue #16335: Fix integer overflow in unicode-escape decoder. --- c35f3a9f619d0d4abd43d16ddc4767e2a30c3dce diff --cc Lib/test/test_ucn.py index 68a3219560,de36cc366f..ff4c4f1700 --- a/Lib/test/test_ucn.py +++ b/Lib/test/test_ucn.py @@@ -8,11 -8,9 +8,12 @@@ Modified for Python 2.0 by Fredrik Lund """#" import unittest +import unicodedata + import _testcapi from test import support +from http.client import HTTPException +from test.test_normalization import check_version class UnicodeNamesTest(unittest.TestCase): diff --cc Objects/unicodeobject.c index b57a8963b9,ddd8d53076..c30245d9f8 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@@ -5696,8 -3923,8 +5696,9 @@@ PyUnicode_DecodeUnicodeEscape(const cha /* found a name. look it up in the unicode database */ message = "unknown Unicode character name"; s++; - if (ucnhash_CAPI->getcode(NULL, start, (int)(s-start-1), + if (s - start - 1 <= INT_MAX && - ucnhash_CAPI->getcode(NULL, start, (int)(s-start-1), &chr)) ++ ucnhash_CAPI->getcode(NULL, start, (int)(s-start-1), + &chr, 0)) goto store; } }