From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Sun, 6 Oct 2019 12:36:44 +0000 (-0700) Subject: bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray.... X-Git-Tag: v3.7.6rc1~131 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b40442ba88fec5e64ab1802ce37df0afec59fa53;p=thirdparty%2FPython%2Fcpython.git bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603) (cherry picked from commit 24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb) Co-authored-by: Hai Shi --- diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c index 07842f746910..7c8ea815494e 100644 --- a/Objects/bytes_methods.c +++ b/Objects/bytes_methods.c @@ -757,7 +757,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 */