mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ng: check can_never_match before validate_fuzzy
This commit is contained in:
parent
c50a931bb4
commit
5edecbf539
@ -330,6 +330,10 @@ bool NG::addGraph(NGWrapper &w) {
|
|||||||
/* ensure utf8 starts at cp boundary */
|
/* ensure utf8 starts at cp boundary */
|
||||||
ensureCodePointStart(rm, w);
|
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 graph's suitability for fuzzing before resolving asserts
|
||||||
validate_fuzzy_compile(w, w.edit_distance, w.utf8, cc.grey);
|
validate_fuzzy_compile(w, w.edit_distance, w.utf8, cc.grey);
|
||||||
|
|
||||||
|
@ -141,3 +141,4 @@
|
|||||||
144:/abc\b/{edit_distance=1} #Zero-width assertions are disallowed for approximate matching.
|
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.
|
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.
|
146:/(*UTF8)abc/{edit_distance=1} #UTF-8 is disallowed for approximate matching.
|
||||||
|
147:/\b\BMYBt/s{edit_distance=1} #Pattern can never match.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user