mirror of
https://github.com/VirusTotal/yara.git
synced 2026-10-11 22:49:58 +00:00
Fix segfault with regular expressions that matched the zero-length string.
In regular expressions, repetition operators`{0,0}` and `{,0}` are valid, but they always match the zero-length string. For instance, `a{0,0}` and `[a-z]{0,0}` both match the zero-length string.
When the whole regular expression consists in one of these repetitions it caused a segfault during the evaluation of the regular expression because the `forward_code_ref` field for the root atom in the atom's tree was null.
Closes #2084.
This commit is contained in:
@@ -2517,6 +2517,8 @@ void test_re()
|
||||
assert_true_regexp("a{0,1}?bc", "abc", "abc");
|
||||
assert_true_regexp("a{0,1}bc", "bbc", "bc");
|
||||
assert_true_regexp("a{0,1}?bc", "abc", "bc");
|
||||
assert_true_regexp("a{,0}", "a", "");
|
||||
assert_true_regexp("a{,0}", "x", "");
|
||||
assert_true_regexp("aa{0,1}?bc", "abc", "abc");
|
||||
assert_true_regexp("aa{0,1}?bc", "abc", "abc");
|
||||
assert_true_regexp("aa{0,1}bc", "abc", "abc");
|
||||
|
||||
Reference in New Issue
Block a user