Commit 022db598 authored by Antoine Pitrou's avatar Antoine Pitrou

Issue #17645: convert an assert() into a proper exception in _Py_Mangle().

parent 0e7df431
......@@ -221,8 +221,11 @@ _Py_Mangle(PyObject *privateobj, PyObject *ident)
}
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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment