Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 81625:f4d30d1a529e 2.7
Issue #16335: Fix integer overflow in unicode-escape decoder.
| author | Serhiy Storchaka <storchaka@gmail.com> |
|---|---|
| date | Mon, 21 Jan 2013 11:48:24 +0200 |
| parents | d544873d62e9 |
| children | 7c8ad0d02664 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Sun Jan 20 23:29:28 2013 +0100 +++ b/Objects/unicodeobject.c Mon Jan 21 11:48:24 2013 +0200 @@ -2899,7 +2899,8 @@ /* 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), &chr)) + if (s - start - 1 <= INT_MAX && + ucnhash_CAPI->getcode(NULL, start, (int)(s-start-1), &chr)) goto store; } }
