Ooops, avoid a division by zero in unicode_repeat()

This commit is contained in:
Victor Stinner 2011-10-01 03:09:58 +02:00
parent d3a83d5eb3
commit c759f3e7ec
1 changed files with 1 additions and 1 deletions

View 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;