From ce3c913909746aa1d782ed8bca5076a656422931 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sun, 6 Oct 2019 05:37:20 -0700 Subject: [PATCH] bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603) (cherry picked from commit 24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb) Co-authored-by: Hai Shi --- Objects/bytes_methods.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c index 37c5f7dbc8040b..7d131842059228 100644 --- a/Objects/bytes_methods.c +++ b/Objects/bytes_methods.c @@ -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 */