From: Justin Viiret Date: Mon, 5 Jun 2017 04:38:57 +0000 (+1000) Subject: hs_expression_info: check unsupported constructs X-Git-Tag: v4.5.0^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9589ee9f90a62136018ea027ea01aaa4a38a6d38;p=thirdparty%2Fvectorscan.git hs_expression_info: check unsupported constructs --- diff --git a/src/hs.cpp b/src/hs.cpp index b93a56ee..33459347 100644 --- a/src/hs.cpp +++ b/src/hs.cpp @@ -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 &g = built_expr.g; ExpressionInfo &expr = built_expr.expr;