[Forensics-changes] [yara] 331/415: Optimize chained strings matching algorithm

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:21 UTC 2014


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

bengen pushed a commit to branch debian
in repository yara.

commit 39669c6cc63df980ac4e108eabd12c5265ec6dc1
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Sat Dec 21 20:21:27 2013 +0100

    Optimize chained strings matching algorithm
---
 libyara/rules.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/libyara/rules.c b/libyara/rules.c
index a4e2f7b..f0ec53d 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -442,10 +442,8 @@ int _yr_scan_handle_chained_matches(
         if (ending_offset + matching_string->chain_gap_max >= match_offset &&
             ending_offset + matching_string->chain_gap_min <= match_offset)
         {
-          _yr_scan_update_match_chain_length(
-              tidx, matching_string->chained_to, match, 1);
-
           add_match = TRUE;
+          break;
         }
       }
 
@@ -457,6 +455,16 @@ int _yr_scan_handle_chained_matches(
   {
     if (STRING_IS_CHAIN_TAIL(matching_string))
     {
+      match = matching_string->chained_to->unconfirmed_matches[tidx].head;
+
+      while (match != NULL)
+      {
+        _yr_scan_update_match_chain_length(
+            tidx, matching_string->chained_to, match, 1);
+
+        match = match->next;
+      }
+
       full_chain_length = 0;
       string = matching_string;
 

-- 
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