summaryrefslogtreecommitdiffhomepage
path: root/src/string.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2020-04-28 11:59:20 +0900
committerHiroshi Mimaki <[email protected]>2020-05-01 16:53:25 +0900
commitd029549c2fb7d6b67bad68b6cf04fa8662e73418 (patch)
tree8dcc5aafe187f442948c87c14d2fe147bfa92f48 /src/string.c
parent6e13467ce8d59334639045a710ddd93193d643e5 (diff)
downloadmruby-d029549c2fb7d6b67bad68b6cf04fa8662e73418.tar.gz
mruby-d029549c2fb7d6b67bad68b6cf04fa8662e73418.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);