Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 83162:0e0a3df5b08d 2.7
Issue #17645: convert an assert() into a proper exception in _Py_Mangle().
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sat, 06 Apr 2013 21:21:04 +0200 |
| parents | 9a3861db4341 |
| children |
line wrap: on
line diff
--- a/Python/compile.c Sat Apr 06 15:19:11 2013 -0400 +++ b/Python/compile.c Sat Apr 06 21:21:04 2013 +0200 @@ -221,8 +221,11 @@ } plen = strlen(p); - assert(1 <= PY_SSIZE_T_MAX - nlen); - assert(1 + nlen <= PY_SSIZE_T_MAX - plen); + if (plen + nlen >= PY_SSIZE_T_MAX - 1) { + PyErr_SetString(PyExc_OverflowError, + "private identifier too large to be mangled"); + return NULL; + } ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); if (!ident)
