Commit c759f3e7 authored by Victor Stinner's avatar Victor Stinner

Ooops, avoid a division by zero in unicode_repeat()

parent d3a83d5e
...@@ -10600,7 +10600,7 @@ unicode_repeat(PyUnicodeObject *str, Py_ssize_t len) ...@@ -10600,7 +10600,7 @@ unicode_repeat(PyUnicodeObject *str, Py_ssize_t len)
if (PyUnicode_READY(str) == -1) if (PyUnicode_READY(str) == -1)
return NULL; 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, PyErr_SetString(PyExc_OverflowError,
"repeated string is too long"); "repeated string is too long");
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment