summaryrefslogtreecommitdiffstats
path: root/Objects/bytes_methods.c
diff options
context:
space:
mode:
authorHai Shi <shihai1992@gmail.com>2019-10-06 12:17:18 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2019-10-06 12:17:18 (GMT)
commit24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb (patch)
treefa605c9437ffecd4d4a819e3cbe78a70c871803b /Objects/bytes_methods.c
parentc38e725d17537b20ff090b1b5ec7db1820ff9b63 (diff)
downloadcpython-24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb.zip
cpython-24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb.tar.gz
cpython-24ddd9c2d6ab61cbce7e68d6de36d4df9bd2c3fb.tar.bz2
bpo-38383: Fix possible integer overflow in startswith() of bytes and bytearray. (GH-16603)
Diffstat (limited to 'Objects/bytes_methods.c')
-rw-r--r--Objects/bytes_methods.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Objects/bytes_methods.c b/Objects/bytes_methods.c
index 37c5f7d..7d13184 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 */