From d3e402928b6eb3327f8f7d59a9edfa622fec557b Mon Sep 17 00:00:00 2001
From: "K.Kosako" <kosako@sofnec.co.jp>
Date: Tue, 13 Aug 2019 13:37:30 +0900
Subject: [PATCH] fix heap-buffer-overflow

---
 regexec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/regexec.c b/regexec.c
index 4582c35..8a17ee7 100644
--- a/regexec.c
+++ b/regexec.c
@@ -3255,6 +3255,7 @@ str_lower_case_match(OnigEncoding enc, int case_fold_flag,
     lowlen = ONIGENC_MBC_CASE_FOLD(enc, case_fold_flag, &p, end, lowbuf);
     q = lowbuf;
     while (lowlen > 0) {
+      if (t >= tend)    return 0;
       if (*t++ != *q++)	return 0;
       lowlen--;
     }
-- 
1.8.3.1

