Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interchangeable strings and variables sections #184

Merged
merged 4 commits into from
Aug 24, 2021

Conversation

tomaskender
Copy link
Contributor

Up until now, you could only define first strings and then variables. Defining variables and then strings was not supported by the parser, even though YARA supports such rule.

The only supported way of defining strings and variables:

rule r {
  strings:
    $1 = "one"
  variables:
    var = 123
  condition:
    true
}

Unsupported rule that throws an error:

rule r {
  variables:
    var = 123
  strings:
    $1 = "one"
  condition:
    true
}

From now on, the parser will successfully parse rules with string and variable sections defined in reverse order as well. The default section order when regenerating such rule back into fulltext representation is going to stay like it used to- first strings and then variables.

@TadeasKucera
Copy link
Contributor

Hello, could you please add a test for the new feature?

@TadeasKucera TadeasKucera self-assigned this Aug 23, 2021
Copy link
Contributor

@TadeasKucera TadeasKucera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through the code and found no issues, good job!

@TadeasKucera TadeasKucera merged commit 85dc815 into avast:master Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants