From 2c32154115fc4fe753eff0075d6a204d899f1cb6 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 28 Apr 2020 11:59:20 +0900 Subject: Fix UTF-8 boundary check; ref #4982 --- src/string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/string.c b/src/string.c index 9ea19d107..2ef1ad95a 100644 --- a/src/string.c +++ b/src/string.c @@ -463,7 +463,7 @@ str_index_str_by_char_search(mrb_state *mrb, const char *p, const char *pend, co } pivot = p + qstable[(unsigned char)p[slen - 1]]; - if (pivot > pend || pivot < p /* overflowed */) { return -1; } + if (pivot >= pend || pivot < p /* overflowed */) { return -1; } do { p += utf8len(p, pend); -- cgit v1.2.3