summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-01-21 09:44:40 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-01-21 09:44:40 (GMT)
commit6481bfb2b5c917041f062da8ebcc7bd7b7727945 (patch)
tree0bfde20393dc4b3514d2734b46bd64354b3b2fdf /Objects
parenta12ff2c682df32c58fae23eef27ab0273f7b8659 (diff)
parentc35f3a9f619d0d4abd43d16ddc4767e2a30c3dce (diff)
downloadcpython-6481bfb2b5c917041f062da8ebcc7bd7b7727945.zip
cpython-6481bfb2b5c917041f062da8ebcc7bd7b7727945.tar.gz
cpython-6481bfb2b5c917041f062da8ebcc7bd7b7727945.tar.bz2
Issue #16335: Fix integer overflow in unicode-escape decoder.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index bd0dbb4..15c284f 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -5569,7 +5569,8 @@ 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),
+ if (s - start - 1 <= INT_MAX &&
+ ucnhash_CAPI->getcode(NULL, start, (int)(s-start-1),
&chr, 0))
goto store;
}