Skip to content

Commit 24ddd9c

Browse files
shihai1991serhiy-storchaka
authored andcommitted
bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603)
1 parent c38e725 commit 24ddd9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Objects/bytes_methods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,7 +743,7 @@ tailmatch(const char *str, Py_ssize_t len, PyObject *substr,
743743

744744
if (direction < 0) {
745745
/* startswith */
746-
if (start + slen > len)
746+
if (start > len - slen)
747747
goto notfound;
748748
} else {
749749
/* endswith */

0 commit comments

Comments
 (0)