diff options
Diffstat (limited to 'Objects/unicodeobject.c')
-rw-r--r-- | Objects/unicodeobject.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 2d60627b19..5ae0af8ea3 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -10572,9 +10572,12 @@ replace(PyObject *self, PyObject *str1, int mayshrink; Py_UCS4 maxchar, maxchar_str1, maxchar_str2; + if (slen < len1) + goto nothing; + if (maxcount < 0) maxcount = PY_SSIZE_T_MAX; - else if (maxcount == 0 || slen == 0) + else if (maxcount == 0) goto nothing; if (str1 == str2) |