]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
hs_expression_info: check unsupported constructs
authorJustin Viiret <justin.viiret@intel.com>
Mon, 5 Jun 2017 04:38:57 +0000 (14:38 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Fri, 9 Jun 2017 00:12:03 +0000 (10:12 +1000)
src/hs.cpp

index b93a56ee9f8a05a99c509b78eb84e2279f245be6..3345934797cf3791e11554064db09d7968297011 100644 (file)
@@ -44,6 +44,7 @@
 #include "parser/parse_error.h"
 #include "parser/Parser.h"
 #include "parser/prefilter.h"
+#include "parser/unsupported.h"
 #include "util/compile_error.h"
 #include "util/cpuid_flags.h"
 #include "util/depth.h"
@@ -376,6 +377,14 @@ hs_error_t hs_expression_info_int(const char *expression, unsigned int flags,
             prefilterTree(pe.component, ParseMode(flags));
         }
 
+        // Expressions containing zero-width assertions and other extended pcre
+        // types aren't supported yet. This call will throw a ParseError
+        // exception if the component tree contains such a construct.
+        checkUnsupported(*pe.component);
+
+        pe.component->checkEmbeddedStartAnchor(true);
+        pe.component->checkEmbeddedEndAnchor(true);
+
         auto built_expr = buildGraph(rm, cc, pe);
         unique_ptr<NGHolder> &g = built_expr.g;
         ExpressionInfo &expr = built_expr.expr;