]> granicus.if.org Git - onig/commitdiff
fix segmentation fault /W.?{888}{888}{888}\x00/ (found by libfuzzer)
authorK.Kosako <kkosako0@gmail.com>
Wed, 31 Aug 2016 14:24:57 +0000 (23:24 +0900)
committerK.Kosako <kkosako0@gmail.com>
Wed, 31 Aug 2016 14:24:57 +0000 (23:24 +0900)
src/regcomp.c

index 5c0f21fbfdae4ce36374f2796c9dcc5f875abc00..0235a9f4d0f3dc782b5e448c8aee7498b19e69cd 100644 (file)
@@ -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