[Forensics-changes] [yara] 16/135: Fix bug introduced in commit 08c8456a0728522b347e936f66b98676a890cd09

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:27:28 UTC 2017


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

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

commit 67eb56c1478dc75b5a9537f968853ececc75c925
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Tue Apr 1 17:58:20 2014 +0200

    Fix bug introduced in commit 08c8456a0728522b347e936f66b98676a890cd09
---
 libyara/re.c    | 6 +++++-
 libyara/rules.c | 5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/libyara/re.c b/libyara/re.c
index bf042aa..ba5eadd 100644
--- a/libyara/re.c
+++ b/libyara/re.c
@@ -1384,8 +1384,12 @@ int yr_re_exec(
   else
     character_size = 1;
 
-  max_count = min(input_size, RE_SCAN_LIMIT);
   input = input_data;
+
+  if (flags & RE_FLAGS_BACKWARDS)
+    input -= character_size;
+
+  max_count = min(input_size, RE_SCAN_LIMIT);
   count = 0;
 
   fiber = _yr_re_fiber_create(&storage->fiber_pool);
diff --git a/libyara/rules.c b/libyara/rules.c
index 67bd717..eae9041 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -184,6 +184,9 @@ int _yr_scan_fast_hex_re_exec(
 
   increment = flags & RE_FLAGS_BACKWARDS ? -1 : 1;
 
+  if (flags & RE_FLAGS_BACKWARDS)
+    input--;
+
   code_stack[sp] = code;
   input_stack[sp] = input;
   matches_stack[sp] = 0;
@@ -704,7 +707,7 @@ int _yr_scan_verify_re_match(
   {
     backward_matches = exec(
         ac_match->backward_code,
-        data + offset - 1,
+        data + offset,
         offset,
         flags | RE_FLAGS_BACKWARDS | RE_FLAGS_EXHAUSTIVE,
         _yr_scan_match_callback,

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