Skip to content

Commit

Permalink
bpo-38383: Fix possible integer overflow in startswith() of bytes and…
Browse files Browse the repository at this point in the history
… bytearray. (GH-16603)

(cherry picked from commit 24ddd9c)

Co-authored-by: Hai Shi <shihai1992@gmail.com>
  • Loading branch information
miss-islington and shihai1991 committed Oct 6, 2019
1 parent dc19124 commit ce3c913
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Objects/bytes_methods.c
Expand Up @@ -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 */
Expand Down

0 comments on commit ce3c913

Please sign in to comment.