diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 09:48:24 (GMT) |
|---|---|---|
| committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-01-21 09:48:24 (GMT) |
| commit | 1d3acd4b59b1685d3b6f58e86ef13b48a9c248bb (patch) | |
| tree | b33ffcd829b2eecc7970c760af0faf0540612c06 /Objects/unicodeobject.c | |
| parent | b357db885c8c20bf085d6b65892a618a51b4e1b0 (diff) | |
| download | cpython-1d3acd4b59b1685d3b6f58e86ef13b48a9c248bb.zip cpython-1d3acd4b59b1685d3b6f58e86ef13b48a9c248bb.tar.gz cpython-1d3acd4b59b1685d3b6f58e86ef13b48a9c248bb.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 46bfe2b..c1b38cc 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2899,7 +2899,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; } } |
