Skip to content

Commit

Permalink
Fix issue #682.
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Manuel Alvarez committed Jun 19, 2017
1 parent 1b1198b commit 41af100
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
21 changes: 15 additions & 6 deletions libyara/re.c
Original file line number Diff line number Diff line change
Expand Up @@ -1803,10 +1803,7 @@ int _yr_re_fiber_sync(
break;

default:
if (_yr_re_fiber_exists(fiber_list, fiber, prev))
fiber = _yr_re_fiber_kill(fiber_list, fiber_pool, fiber);
else
fiber = fiber->next;
fiber = fiber->next;
}
}

Expand Down Expand Up @@ -1940,12 +1937,24 @@ int yr_re_exec(
{
fiber = fibers.head;

while(fiber != NULL)
while (fiber != NULL)
{
next_fiber = fiber->next;

if (_yr_re_fiber_exists(&fibers, fiber, fiber->prev))
_yr_re_fiber_kill(&fibers, &storage->fiber_pool, fiber);

fiber = next_fiber;
}

fiber = fibers.head;

while (fiber != NULL)
{
ip = fiber->ip;
action = ACTION_NONE;

switch(*ip)
switch (*ip)
{
case RE_OPCODE_ANY:
prolog;
Expand Down
3 changes: 3 additions & 0 deletions tests/test-rules.c
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,9 @@ void test_re()

assert_regexp_syntax_error("\\xxy");

// Test case for issue #682
assert_true_regexp("(a|\\b)[a]{1,}", "aaaa", "aaaa");

assert_error(
"rule test { strings: $a = /a\\/ condition: $a }",
ERROR_SYNTAX_ERROR);
Expand Down

0 comments on commit 41af100

Please sign in to comment.