From 9c840a68e212fb54136b67711daff331435c1ce7 Mon Sep 17 00:00:00 2001 From: "Yukihiro \"Matz\" Matsumoto" Date: Tue, 13 Feb 2024 22:36:03 +0900 Subject: [PATCH] string.c (memsearch_swar): boundary check by the latest position --- src/string.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/string.c b/src/string.c index e214ad4c2..780ab4e5e 100644 --- a/src/string.c +++ b/src/string.c @@ -578,7 +578,7 @@ str_index_str_by_char(mrb_state *mrb, mrb_value str, mrb_value sub, mrb_int pos) * fixed potential buffer overflow */ static inline mrb_int -memsearch_swar(const char *xs, long m, const char *ys, long n) +memsearch_swar(const char *xs, mrb_int m, const char *ys, mrb_int n) { #ifdef MRB_64BIT #define bitint uint64_t @@ -641,9 +641,9 @@ memsearch_swar(const char *xs, long m, const char *ys, long n) const char *p = s0; const char *e = ys + n; for (;p