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:
parent
dc191245d8
commit
ce3c913909
|
@ -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 */
|
||||||
|
|
Loading…
Reference in New Issue