[Forensics-changes] [yara] 163/415: Fix bug causing segmentation fault

Hilko Bengen bengen at moszumanska.debian.org
Thu Apr 3 05:43:01 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 debbcdd258e8565f44ac829e273d2f473f762c41
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Tue May 28 10:39:41 2013 +0000

    Fix bug causing segmentation fault
---
 libyara/rules.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/libyara/rules.c b/libyara/rules.c
index ff32b60..45e4737 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -570,14 +570,17 @@ int yr_rules_scan_mem_block(
 
     while (ac_match != NULL)
     {
-      result = _yr_scan_verify_match(
-          ac_match,
-          data,
-          data_size,
-          i - ac_match->backtrack);
-
-      if (result != ERROR_SUCCESS)
-        return result;
+      if (i >= ac_match->backtrack)
+      {
+        result = _yr_scan_verify_match(
+            ac_match,
+            data,
+            data_size,
+            i - ac_match->backtrack);
+
+        if (result != ERROR_SUCCESS)
+          return result;
+      }
 
       ac_match = ac_match->next;
     }
@@ -616,8 +619,6 @@ int yr_rules_scan_mem_block(
 }
 
 
-#include <time.h>
-
 int yr_rules_scan_mem_blocks(
     YARA_RULES* rules,
     MEMORY_BLOCK* block,
@@ -634,10 +635,6 @@ int yr_rules_scan_mem_blocks(
   context.mem_block = block;
   context.entry_point = UNDEFINED;
 
-  clock_t start, end;
-
-  start = clock();
-
   yr_rules_free_matches(rules);
 
   while (block != NULL)
@@ -704,9 +701,6 @@ int yr_rules_scan_mem_blocks(
     rule++;
   }
 
-  end = clock();
-  printf( "Scanning time: %f s\n", (float)(end - start) / CLOCKS_PER_SEC);
-
   return ERROR_SUCCESS;
 }
 

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