[Forensics-changes] [yara] 18/407: Fix bugs in previous commit

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


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

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

commit 4a0e558161170be75b08520788f38b3000541da1
Author: Victor Manuel Alvarez <vmalvarez at virustotal.com>
Date:   Tue Sep 2 14:32:37 2014 +0200

    Fix bugs in previous commit
---
 libyara/parser.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libyara/parser.c b/libyara/parser.c
index 3f8dd5a..81f7eb0 100644
--- a/libyara/parser.c
+++ b/libyara/parser.c
@@ -142,6 +142,7 @@ int yr_parser_emit_pushes_for_strings(
             NULL);
 
         string->g_flags |= STRING_GFLAGS_REFERENCED;
+        string->g_flags &= ~STRING_GFLAGS_FIXED_OFFSET;
         matching++;
       }
     }
@@ -593,6 +594,12 @@ YR_STRING* yr_parser_reduce_string_declaration(
       aux_string->chain_gap_max = max_gap;
 
       prev_string->chained_to = aux_string;
+
+      // prev_string is now chained to aux_string, an string chained
+      // to another one can't have a fixed offset, only the head of the
+      // string chain can have a fixed offset.
+
+      prev_string->g_flags &= ~STRING_GFLAGS_FIXED_OFFSET;
     }
   }
   else
@@ -821,8 +828,11 @@ int yr_parser_reduce_string_identifier(
         // the STRING_GFLAGS_FIXED_OFFSET flag because we only
         // have room to store a single fixed offset value
 
-        if (string->fixed_offset != at_offset)
+        if (string->fixed_offset == UNDEFINED ||
+            string->fixed_offset != at_offset)
+        {
           string->g_flags &= ~STRING_GFLAGS_FIXED_OFFSET;
+        }
       }
       else
       {

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