]> granicus.if.org Git - onig/commitdiff
fix setting condition of data_range value
authorK.Kosako <kosako@sofnec.co.jp>
Wed, 25 Sep 2019 02:23:11 +0000 (11:23 +0900)
committerK.Kosako <kosako@sofnec.co.jp>
Wed, 25 Sep 2019 02:23:11 +0000 (11:23 +0900)
src/regexec.c

index ce7fb173f96f61da7f35936c5e5302efae5560d7..e2d1125fb9904afb0fcf99be67a2f418218b912f 100644 (file)
@@ -5356,10 +5356,10 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
   onig_initialize_match_param(&mp);
 
   /* The following is an expanded code of onig_search_with_param()  */
-  if (range < start)
-    data_range = end;
-  else
+  if (range > start)
     data_range = range;
+  else
+    data_range = end;
 
   r = search_in_range(reg, str, end, start, range, data_range, region,
                       option, &mp);
@@ -5371,7 +5371,7 @@ onig_search(regex_t* reg, const UChar* str, const UChar* end,
 
 static int
 search_in_range(regex_t* reg, const UChar* str, const UChar* end,
-                const UChar* start, const UChar* range, /* match range */
+                const UChar* start, const UChar* range, /* match start range */
                 const UChar* data_range, /* subject string range */
                 OnigRegion* region,
                 OnigOptionType option, OnigMatchParam* mp)
@@ -5726,10 +5726,10 @@ onig_search_with_param(regex_t* reg, const UChar* str, const UChar* end,
 {
   const UChar* data_range;
 
-  if (range < start)
-    data_range = end;
-  else
+  if (range > start)
     data_range = range;
+  else
+    data_range = end;
 
   return search_in_range(reg, str, end, start, range, data_range, region,
                          option, mp);