From: Victor Stinner Date: Sat, 1 Oct 2011 01:09:58 +0000 (+0200) Subject: Ooops, avoid a division by zero in unicode_repeat() X-Git-Tag: v3.3.0a1~1413 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c759f3e7ec1ba9753d197d3708b379369586f270;p=thirdparty%2FPython%2Fcpython.git Ooops, avoid a division by zero in unicode_repeat() --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index fed2cc9fb4f0..92208f462c15 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -10600,7 +10600,7 @@ unicode_repeat(PyUnicodeObject *str, Py_ssize_t len) if (PyUnicode_READY(str) == -1) return NULL; - if (len > PY_SSIZE_T_MAX / PyUnicode_GET_LENGTH(str)) { + if (PyUnicode_GET_LENGTH(str) > PY_SSIZE_T_MAX / len) { PyErr_SetString(PyExc_OverflowError, "repeated string is too long"); return NULL;