From: K.Kosako Date: Wed, 31 Aug 2016 14:24:57 +0000 (+0900) Subject: fix segmentation fault /W.?{888}{888}{888}\x00/ (found by libfuzzer) X-Git-Tag: v6.1.1~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9574bc14266a6f8b3c9161d68fb1bc842bcf85a4;p=onig fix segmentation fault /W.?{888}{888}{888}\x00/ (found by libfuzzer) --- diff --git a/src/regcomp.c b/src/regcomp.c index 5c0f21f..0235a9f 100644 --- a/src/regcomp.c +++ b/src/regcomp.c @@ -4031,12 +4031,12 @@ distance_value(MinMaxLen* mm) 11, 11, 11, 11, 11, 10, 10, 10, 10, 10 }; - int d; + OnigLen d; if (mm->max == ONIG_INFINITE_DISTANCE) return 0; d = mm->max - mm->min; - if (d < (int )(sizeof(dist_vals)/sizeof(dist_vals[0]))) + if (d < (OnigLen )(sizeof(dist_vals)/sizeof(dist_vals[0]))) /* return dist_vals[d] * 16 / (mm->min + 12); */ return (int )dist_vals[d]; else