[Forensics-changes] [yara] 89/368: Use stack-size from context, rather than #define

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:14 UTC 2017


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

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

commit 9accec56082d1192d5834c14993b7a4ad56a1ae7
Author: Coleman Kane <ckane at colemankane.org>
Date:   Fri Oct 9 20:06:44 2015 -0400

    Use stack-size from context, rather than #define
---
 libyara/exec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libyara/exec.c b/libyara/exec.c
index 63f9b4e..c477d28 100644
--- a/libyara/exec.c
+++ b/libyara/exec.c
@@ -34,7 +34,6 @@ limitations under the License.
 #include <yara.h>
 
 
-#define STACK_SIZE 16384
 #define MEM_SIZE   MAX_LOOP_NESTING * LOOP_LOCAL_VARS
 
 typedef union _STACK_ITEM {
@@ -51,7 +50,7 @@ typedef union _STACK_ITEM {
 
 #define push(x)  \
     do { \
-      if (sp < STACK_SIZE) stack[sp++] = (x); \
+      if (sp < context->stacksize) stack[sp++] = (x); \
       else return ERROR_EXEC_STACK_OVERFLOW; \
     } while(0)
 
@@ -189,7 +188,7 @@ int yr_execute_code(
   clock_t start = clock();
   #endif
 
-  stack = (STACK_ITEM *) yr_malloc(STACK_SIZE * sizeof(STACK_ITEM));
+  stack = (STACK_ITEM *) yr_malloc(context->stacksize * sizeof(STACK_ITEM));
 
   if (stack == NULL)
     return ERROR_INSUFICIENT_MEMORY;

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