[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

Török Edvin edwin at clamav.net
Sun Apr 4 01:22:07 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit bc157ce35714de4bdda39fd13a67f708f316cbc3
Author: Török Edvin <edwin at clamav.net>
Date:   Sat Mar 6 16:00:54 2010 +0200

    prepare for reading globals from ctx

diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c
index b2219d5..dd5ebd0 100644
--- a/libclamav/bytecode.c
+++ b/libclamav/bytecode.c
@@ -67,6 +67,8 @@ struct cli_bc_ctx *cli_bytecode_context_alloc(void)
     ctx->line = 0;
     ctx->col = 0;
     ctx->mpool = NULL;
+    ctx->numGlobals = 0;
+    ctx->globals = NULL;
     return ctx;
 }
 
diff --git a/libclamav/bytecode_priv.h b/libclamav/bytecode_priv.h
index 8604084..2daa3f7 100644
--- a/libclamav/bytecode_priv.h
+++ b/libclamav/bytecode_priv.h
@@ -147,6 +147,8 @@ struct cli_bc_ctx {
     unsigned line;
     unsigned col;
     mpool_t *mpool;
+    uint32_t numGlobals;
+    uint8_t* globals;
 };
 struct cli_all_bc;
 int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct cli_bc_func *func, const struct cli_bc_inst *inst);
diff --git a/libclamav/bytecode_vm.c b/libclamav/bytecode_vm.c
index 85d95e9..05c4522 100644
--- a/libclamav/bytecode_vm.c
+++ b/libclamav/bytecode_vm.c
@@ -262,7 +262,15 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
     x = *(uint_type(n)*)&(from)[(p)];\
     TRACE_R(x)
 
-#define READN(x, n, p) READNfrom(func->numBytes, values, x, n, p)
+#define READN(x, n, p)\
+ do {\
+     if (p&0x80000000) {\
+	 uint32_t pg = p&0x7fffffff;\
+	 READNfrom(ctx->numGlobals, ctx->globals, x, n, p);\
+     } else {\
+	 READNfrom(func->numBytes, values, x, n, p);\
+     }\
+ } while (0)
 
 #define READ1(x, p) READN(x, 8, p);\
     x = x&1

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list