diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 09:38:00 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 09:38:00 (GMT) |
commit | 4f5f0e54e07838b29e3a2e043e9c9b12aeecb12f (patch) | |
tree | cc5e30144b4ce05686542d88b970974bb958fd37 /Objects/unicodeobject.c | |
parent | 410eee566f3bf2a33bfd1156ad8bb86f697c4749 (diff) | |
download | cpython-4f5f0e54e07838b29e3a2e043e9c9b12aeecb12f.zip cpython-4f5f0e54e07838b29e3a2e043e9c9b12aeecb12f.tar.gz cpython-4f5f0e54e07838b29e3a2e043e9c9b12aeecb12f.tar.bz2 |
Issue #16335: Fix integer overflow in unicode-escape decoder.
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 80a70b6..ddd8d53 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3923,7 +3923,8 @@ PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, /* 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; } } |