diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-10-06 05:37:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-06 05:37:20 -0700 |
commit | ce3c913909746aa1d782ed8bca5076a656422931 (patch) | |
tree | b57c0de43e2676b9572598ce64e3adce6fdce10d | |
parent | dc191245d8f63f5ab41afff0468b7463a07e7b00 (diff) | |
download | cpython-git-ce3c913909746aa1d782ed8bca5076a656422931.tar.gz |
bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603)
(cherry picked from commit 24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb)
Co-authored-by: Hai Shi <shihai1992@gmail.com>
-rw-r--r-- | Objects/bytes_methods.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c index 37c5f7dbc8..7d13184205 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 */ |