Fix UTF-8 boundary check; ref #4982

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-04-28 11:59:20 +09:00
parent 47d99457d9
commit 2c32154115
+1 -1
View File
@@ -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);