You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a regular expression containing a character class, followed by a dash -, followed by anything else, Yara fails with the following error:
$ /usr/bin/yara -s ~/testrule.yara ~/yara_test_file.txt
~/testrule.yara(3): error: invalid regular expression "$": bad character range
It appears this error message is related to the following section of the RE lexer, where it doesn't properly look for the ending square bracket of the character range and therefore over-matches on the dash outside.
Regular expressions with a character class followed by a dash (-) failed with "bad character range". For example, /[0-9]-2/ was not accepted as a valid regexp.
Regular expressions with a character class followed by a dash (-) failed with "bad character range". For example, /[0-9]-2/ was not accepted as a valid regexp.
Regular expressions with a character class followed by a dash (-) failed with "bad character range". For example, /[0-9]-2/ was not accepted as a valid regexp.
When using a regular expression containing a character class, followed by a dash
-
, followed by anything else, Yara fails with the following error:It appears this error message is related to the following section of the RE lexer, where it doesn't properly look for the ending square bracket of the character range and therefore over-matches on the dash outside.
yara/libyara/re_lexer.l
Line 311 in 7e00915
This is the test rule I'm using, and the test file being scanned.
Using grep, regex101, or similar, we can confirm the regex works as expected and is valid.
The text was updated successfully, but these errors were encountered: