From c759f3e7ec1ba9753d197d3708b379369586f270 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 1 Oct 2011 03:09:58 +0200 Subject: Ooops, avoid a division by zero in unicode_repeat() --- Objects/unicodeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index fed2cc9..92208f4 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; -- cgit v0.12