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

(cherry picked from commit 24ddd9c2d6)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
This commit is contained in:
Miss Islington (bot) 2019-10-06 05:37:20 -07:00 committed by GitHub
parent dc191245d8
commit ce3c913909
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

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