Przeglądaj źródła

HPCC-15832 Regex unicode can core on illegal regex

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 9 lat temu
rodzic
commit
504d67a05f
3 zmienionych plików z 5 dodań i 3 usunięć
  1. 1 0
      ecl/regress/regex4.ecl
  2. 1 0
      ecl/regress/regex5.ecl
  3. 3 3
      rtl/eclrtl/eclregex.cpp

+ 1 - 0
ecl/regress/regex4.ecl

@@ -0,0 +1 @@
+REGEXREPLACE(u'a[', 'b', 'c');

+ 1 - 0
ecl/regress/regex5.ecl

@@ -0,0 +1 @@
+REGEXREPLACE('a[', 'b', 'c');

+ 3 - 3
rtl/eclrtl/eclregex.cpp

@@ -344,7 +344,7 @@ public:
         else
             pattern = RegexPattern::compile(_UregExp, UREGEX_CASE_INSENSITIVE, uperr, uerr);
 
-        matcher = pattern->matcher(uerr);
+        matcher = pattern ? pattern->matcher(uerr) : NULL;
         if (U_FAILURE(uerr))
         {
             char * expAscii;
@@ -357,8 +357,8 @@ public:
             rtlFree(expAscii);
             delete matcher;
             delete pattern;
-            matcher = 0;
-            pattern = 0;
+            matcher = NULL;
+            pattern = NULL;
             rtlFail(0, msg.c_str());  //throws
         }
     }