]> granicus.if.org Git - onig/commitdiff
fix #58 : access to invalid address by reg->dmin value
authorK.Kosako <kosako@sofnec.co.jp>
Tue, 23 May 2017 07:15:35 +0000 (16:15 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Tue, 23 May 2017 07:15:35 +0000 (16:15 +0900)
src/regexec.c

index d4e577d96aa947d945956920201763db0abacf08..2fa0f3d37e07d62954c8421205f8058e4f25a2fb 100644 (file)
@@ -3154,6 +3154,8 @@ forward_search_range(regex_t* reg, const UChar* str, const UChar* end, UChar* s,
     }
     else {
       UChar *q = p + reg->dmin;
+
+      if (q >= end) return 0; /* fail */
       while (p < q) p += enclen(reg->enc, p);
     }
   }