]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
ng: check can_never_match before validate_fuzzy
authorJustin Viiret <justin.viiret@intel.com>
Mon, 6 Mar 2017 03:15:56 +0000 (14:15 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 05:16:03 +0000 (15:16 +1000)
src/nfagraph/ng.cpp
unit/hyperscan/bad_patterns.txt

index 9453aae921bb9eb151ff0d231ca38679f6df1db1..2f6d8cd7998cc2e5a4612a4276ce668faa1018b9 100644 (file)
@@ -330,6 +330,10 @@ bool NG::addGraph(NGWrapper &w) {
     /* ensure utf8 starts at cp boundary */
     ensureCodePointStart(rm, w);
 
+    if (can_never_match(w)) {
+        throw CompileError(w.expressionIndex, "Pattern can never match.");
+    }
+
     // validate graph's suitability for fuzzing before resolving asserts
     validate_fuzzy_compile(w, w.edit_distance, w.utf8, cc.grey);
 
index 09a2f7e146713650bf1e6b6175f4d7b2ad657583..3d6d9db909714f9cc98144ff5b03ae13b7171d45 100644 (file)
 144:/abc\b/{edit_distance=1} #Zero-width assertions are disallowed for approximate matching.
 145:/abc/8{edit_distance=1} #UTF-8 is disallowed for approximate matching.
 146:/(*UTF8)abc/{edit_distance=1} #UTF-8 is disallowed for approximate matching.
+147:/\b\BMYBt/s{edit_distance=1} #Pattern can never match.