]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Ooops, avoid a division by zero in unicode_repeat()
authorVictor Stinner <victor.stinner@haypocalc.com>
Sat, 1 Oct 2011 01:09:58 +0000 (03:09 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sat, 1 Oct 2011 01:09:58 +0000 (03:09 +0200)
Objects/unicodeobject.c

index fed2cc9fb4f0faa1518e2094b23d0f6f0a2ff8b7..92208f462c15c154aec00113fcfa0bf54f48c683 100644 (file)
@@ -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;