Skip to content

Commit

Permalink
Fix another compiler edge case. (VirusTotal#1722)
Browse files Browse the repository at this point in the history
* Fix another compiler edge case.

When compiling and we encounter a range that has values we can determine at
compile time we should error out if the lower bound is less than 0.

* Fix OP_COUNT_IN paranoid check.

The OP_COUNT_IN operation does not need the paranoid check on r1 as it is the
lower bound of the range, and thus a constant and not a pointer somewhere. It
should, instead, be checking r3.

Fixes VirusTotal#1721 (the first half of it).
  • Loading branch information
wxsBSD committed Jun 1, 2022
1 parent 6c5fd5e commit ccbc405
Show file tree
Hide file tree
Showing 4 changed files with 141 additions and 119 deletions.
2 changes: 1 addition & 1 deletion libyara/exec.c
Expand Up @@ -1407,7 +1407,7 @@ int yr_execute_code(YR_SCAN_CONTEXT* context)
ensure_defined(r2);

#if YR_PARANOID_EXEC
ensure_within_rules_arena(r1.p);
ensure_within_rules_arena(r3.p);
#endif

match = context->matches[r3.s->idx].head;
Expand Down

0 comments on commit ccbc405

Please sign in to comment.