[Forensics-changes] [yara] 86/135: Fix issue #148 by asserting that yr_compiler_get_rules was not called before yr_compiler_add_file/yr_compiler_add_string

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:27:35 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 33bd8fdf48698af33b9276103fb42174c495fbf2
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Mon Aug 11 09:51:51 2014 +0200

    Fix issue #148 by asserting that yr_compiler_get_rules was not called before yr_compiler_add_file/yr_compiler_add_string
---
 libyara/compiler.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/libyara/compiler.c b/libyara/compiler.c
index 5f88718..de59c35 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -320,6 +320,11 @@ int yr_compiler_add_file(
     const char* namespace_,
     const char* file_name)
 {
+  // Don't allow yr_compiler_add_file() after
+  // yr_compiler_get_rules() has been called.
+
+  assert(compiler->compiled_rules_arena == NULL);
+
   if (file_name != NULL)
     _yr_compiler_push_file_name(compiler, file_name);
 
@@ -337,6 +342,11 @@ int yr_compiler_add_string(
     const char* rules_string,
     const char* namespace_)
 {
+  // Don't allow yr_compiler_add_string() after
+  // yr_compiler_get_rules() has been called.
+
+  assert(compiler->compiled_rules_arena == NULL);
+
   if (namespace_ != NULL)
     _yr_compiler_set_namespace(compiler, namespace_);
   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