summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-04-28 11:59:20 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2020-04-28 13:57:46 +0900
commit2c32154115fc4fe753eff0075d6a204d899f1cb6 (patch)
tree6c28192299abb35657a19c34ce0bae507d92eaa0 /src/string.c
parent47d99457d915a59022c16be66c99e660345b04c9 (diff)
downloadmruby-2c32154115fc4fe753eff0075d6a204d899f1cb6.tar.gz
mruby-2c32154115fc4fe753eff0075d6a204d899f1cb6.zip
Fix UTF-8 boundary check; ref #4982
Diffstat (limited to 'src/string.c')
-rw-r--r--src/string.c2
1 files changed, 1 insertions, 1 deletions
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);