summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-04-07 09:53:49 -0400
committerBenjamin Peterson <benjamin@python.org>2013-04-07 09:53:49 -0400
commit5a3c6dbe6a9c6100dcdf91e9773d50d97268e1ba (patch)
treefd50a3c04227f900de3224a1782872c1b7e6832e /Python/compile.c
parent20efcfaf538c52c7d65117bf8427b6b248c54dbe (diff)
parent8ab1e513c1451895afd95ef2e07905ab07dc9909 (diff)
downloadcpython-git-5a3c6dbe6a9c6100dcdf91e9773d50d97268e1ba.tar.gz
merge heads
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 0aca8bd2e9..842ed50bec 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -248,8 +248,11 @@ _Py_Mangle(PyObject *privateobj, PyObject *ident)
}
plen -= ipriv;
- 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;
+ }
maxchar = PyUnicode_MAX_CHAR_VALUE(ident);
if (PyUnicode_MAX_CHAR_VALUE(privateobj) > maxchar)