diff options
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/ast.c b/Python/ast.c index da42a0e..79c9403 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -3145,6 +3145,9 @@ decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, cons buf = (char *)s; u = NULL; } else { + /* check for integer overflow */ + if (len > PY_SIZE_MAX / 4) + return NULL; /* "\XX" may become "\u005c\uHHLL" (12 bytes) */ u = PyBytes_FromStringAndSize((char *)NULL, len * 4); if (u == NULL) |