Mercurial > cpython-lru_cache-weakref
diff Objects/unicodeobject.c @ 72557:17aba77fa99c
Ooops, avoid a division by zero in unicode_repeat()
| author | Victor Stinner <victor.stinner@haypocalc.com> |
|---|---|
| date | Sat, 01 Oct 2011 03:09:58 +0200 |
| parents | 58e3373f06d1 |
| children | 45f1de829d70 bb0264220858 |
line wrap: on
line diff
--- a/Objects/unicodeobject.c Sat Oct 01 03:09:33 2011 +0200 +++ b/Objects/unicodeobject.c Sat Oct 01 03:09:58 2011 +0200 @@ -10600,7 +10600,7 @@ 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;
