Commit 24ddd9c2 authored by Hai Shi's avatar Hai Shi Committed by Serhiy Storchaka

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

parent c38e725d
...@@ -743,7 +743,7 @@ tailmatch(const char *str, Py_ssize_t len, PyObject *substr, ...@@ -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 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment