[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:25:11 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 4993d6cf02dcf19969f9ed7644a668d2c6340dad
Author: Török Edvin <edwin at clamav.net>
Date: Tue Mar 23 23:46:58 2010 +0200
Making progress on match_with_read.
diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c
index a0a08f7..fd8315a 100644
--- a/libclamav/bytecode.c
+++ b/libclamav/bytecode.c
@@ -553,7 +553,7 @@ static void add_static_types(struct cli_bc *bc)
bc->types[i].kind = DPointerType;
bc->types[i].numElements = 1;
bc->types[i].containedTypes = &containedTy[i];
- bc->types[i].size = bc->types[i].align = sizeof(void*);
+ bc->types[i].size = bc->types[i].align = 8;
}
}
@@ -1694,6 +1694,10 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
case OP_BC_GEP1:
case OP_BC_GEPZ:
/*three[0] is the type*/
+ if (bcfunc->types[inst->u.three[1]]&0x8000)
+ inst->interp_op = 5*(inst->interp_op/5);
+ else
+ inst->interp_op = 5*(inst->interp_op/5)+3;
MAP(inst->u.three[1]);
MAP(inst->u.three[2]);
break;
diff --git a/libclamav/bytecode_vm.c b/libclamav/bytecode_vm.c
index 2f42c74..8b9464a 100644
--- a/libclamav/bytecode_vm.c
+++ b/libclamav/bytecode_vm.c
@@ -461,7 +461,7 @@ static inline int64_t ptr_compose(int32_t id, uint32_t offset)
return (i << 32) | offset;
}
-static inline int32_t ptr_register_stack(struct ptr_infos *infos,
+static inline int64_t ptr_register_stack(struct ptr_infos *infos,
unsigned char *values,
uint32_t off, uint32_t size)
{
@@ -476,7 +476,7 @@ static inline int32_t ptr_register_stack(struct ptr_infos *infos,
sinfos = &sinfos[n-1];
sinfos->base = values + off;
sinfos->size = size;
- return ptr_compose(-(n-1), 0);
+ return ptr_compose(-n, 0);
}
static inline int64_t ptr_register_glob_fixedid(struct ptr_infos *infos,
@@ -524,7 +524,7 @@ static inline void* ptr_torealptr(const struct ptr_infos *infos, int64_t ptr,
return NULL;
}
if (ptrid < 0) {
- ptrid = -ptrid;
+ ptrid = -ptrid-1;
if (UNLIKELY(ptrid >= infos->nstacks)) {
bcfail("ptr", ptrid, infos->nstacks, __FILE__, __LINE__);
return NULL;
@@ -589,6 +589,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
char *old_values;
struct ptr_infos ptrinfos;
struct timeval tv0, tv1, timeout;
+ int stackid = 0;
memset(&ptrinfos, 0, sizeof(ptrinfos));
memset(&stack, 0, sizeof(stack));
@@ -789,6 +790,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
break;
}
values = stack_entry->values;
+ /* TODO: unregister on ret */
TRACE_EXEC(inst->u.ops.funcid, inst->dest, inst->type, stack_depth);
if (stack_depth > 10000) {
cli_errmsg("bytecode: stack depth exceeded\n");
@@ -835,6 +837,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
}
}
func = func2;
+ stackid = ptr_register_stack(&ptrinfos, values, 0, func->numBytes)>>32;
CHECK_GT(func->numBB, 0);
stop = jump(func, 0, &bb, &inst, &bb_inst);
stack_depth++;
@@ -955,6 +958,17 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
WRITE8(inst->dest, WORDS_BIGENDIAN);
break;
}
+ DEFINE_OP(OP_BC_GEPZ) {
+ int64_t ptr;
+ if (!(inst->interp_op%5)) {
+ WRITE64(inst->dest, ptr_compose(stackid,
+ inst->u.unaryop));
+ } else {
+ READ64(ptr, inst->u.unaryop);
+ WRITE64(inst->dest, ptr);
+ }
+ break;
+ }
/* TODO: implement OP_BC_GEP1, OP_BC_GEP2, OP_BC_GEPN */
default:
cli_errmsg("Opcode %u of type %u is not implemented yet!\n",
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list