[Forensics-changes] [yara] 05/15: Fix issue #682.

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:33:22 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.6.2
in repository yara.

commit 6fb5ba061543fa85120dddc7dd2a5c53a7606f5f
Author: Victor Manuel Alvarez <vmalvarez at vmalvarez-macbookpro.roam.corp.google.com>
Date:   Mon Jun 19 10:17:30 2017 +0200

    Fix issue #682.
---
 libyara/re.c       | 21 +++++++++++++++------
 tests/test-rules.c |  3 +++
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/libyara/re.c b/libyara/re.c
index 1b767ff..2a7b104 100644
--- a/libyara/re.c
+++ b/libyara/re.c
@@ -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;
     }
   }
 
@@ -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;
diff --git a/tests/test-rules.c b/tests/test-rules.c
index 2a28c00..cb15c68 100644
--- a/tests/test-rules.c
+++ b/tests/test-rules.c
@@ -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);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list