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

Yara: Fix crash with partially loaded yara files #261

Merged

Conversation

micahsnyder
Copy link
Contributor

Yara rule files may contain multiple signatures. If one of the
signatures fails to load because of a parse error in the yara rule
condition, the rest of the rules still load. This is fine, but it seems
that something isn't properly cleaned up, so there end up being runtime
crashes when running the correctly loaded rules as a result.

Specifically, the crash occurs because of an assert() that expects the
operation stack to be empty and it is not. A simple fix is to print an
error or debug message instead of crashing. It's not the right fix, but
it at least prevents crash.

Resolves: https://bugzilla.clamav.net/show_bug.cgi?id=12077

Also fixed a bunch of warnings in the yara module caused by comparing
different integer types.

Yara rule files may contain multiple signatures. If one of the
signatures fails to load because of a parse error in the yara rule
condition, the rest of the rules still load. This is fine, but it seems
that something isn't properly cleaned up, so there end up being runtime
crashes when running the correctly loaded rules as a result.

Specifically, the crash occurs because of an assert() that expects the
operation stack to be empty and it is not. A simple fix is to print an
error or debug message instead of crashing. It's not the right fix, but
it at least prevents crash.

Resolves: https://bugzilla.clamav.net/show_bug.cgi?id=12077

Also fixed a bunch of warnings in the yara module caused by comparing
different integer types.
@micahsnyder micahsnyder merged commit f330951 into Cisco-Talos:main Oct 11, 2021
@micahsnyder micahsnyder deleted the CLAM-251-yara-load-runtime-crash branch October 11, 2021 18:50
@micahsnyder
Copy link
Contributor Author

Also cherry-picked to:

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