Fix UTF-8 boundary check; ref #4982

This commit is contained in:
Yukihiro "Matz" Matsumoto
2020-04-28 11:59:20 +09:00
committed by Hiroshi Mimaki
parent 6e13467ce8
commit d029549c2f
+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);