bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603)

This commit is contained in:
Hai Shi 2019-10-06 20:17:18 +08:00 committed by Serhiy Storchaka
parent c38e725d17
commit 24ddd9c2d6

View File

@ -743,7 +743,7 @@ tailmatch(const char *str, Py_ssize_t len, PyObject *substr,
if (direction < 0) {
/* startswith */
if (start + slen > len)
if (start > len - slen)
goto notfound;
} else {
/* endswith */