[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:27:27 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 349e6e118be593a41b277caa253c769cf3655872
Author: Török Edvin <edwin at clamav.net>
Date: Mon Mar 29 23:47:59 2010 +0300
More interpreter fixes, pdf.cbc seems to be running now.
diff --git a/clambc/bcrun.c b/clambc/bcrun.c
index 4d06bdd..1a21706 100644
--- a/clambc/bcrun.c
+++ b/clambc/bcrun.c
@@ -316,6 +316,7 @@ int main(int argc, char *argv[])
} else if (optget(opts, "printsrc")->enabled) {
print_src(opts->filename[0]);
} else {
+ fmap_t *map = NULL;
rc = cli_bytecode_prepare(&bcs, BYTECODE_ENGINE_MASK);
if (rc != CL_SUCCESS) {
fprintf(stderr,"Unable to prepare bytecode: %s\n", cl_strerror(rc));
@@ -361,7 +362,6 @@ int main(int argc, char *argv[])
}
if ((opt = optget(opts,"input"))->enabled) {
- fmap_t *map;
fd = open(opt->strarg, O_RDONLY);
if (fd == -1) {
fprintf(stderr, "Unable to open input file %s: %s\n", opt->strarg, strerror(errno));
@@ -378,7 +378,6 @@ int main(int argc, char *argv[])
optfree(opts);
exit(5);
}
- funmap(map);
}
/* for testing */
ctx->hooks.match_counts = deadbeefcounts;
@@ -394,6 +393,8 @@ int main(int argc, char *argv[])
printf("[clambc] Bytecode returned: 0x%llx\n", (long long)v);
}
cli_bytecode_context_destroy(ctx);
+ if (map)
+ funmap(map);
}
cli_bytecode_destroy(bc);
cli_bytecode_done(&bcs);
diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c
index 36ca917..eed37e7 100644
--- a/libclamav/bytecode.c
+++ b/libclamav/bytecode.c
@@ -1743,7 +1743,7 @@ static int cli_bytecode_prepare_interpreter(struct cli_bc *bc)
} else
inst->u.ops.opsizes = NULL;
for (k=0;k<inst->u.ops.numOps;k++) {
- MAP(inst->u.ops.ops[k]);
+ MAPPTR(inst->u.ops.ops[k]);
if (inst->opcode == OP_BC_CALL_DIRECT)
inst->u.ops.opsizes[k] = typesize(bc, target->types[k]);
else
diff --git a/libclamav/bytecode_api.c b/libclamav/bytecode_api.c
index 4cb6fae..b1f2c25 100644
--- a/libclamav/bytecode_api.c
+++ b/libclamav/bytecode_api.c
@@ -424,15 +424,17 @@ int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx, int32_t id)
cli_dbgmsg("previous tempfile had %u bytes\n", ctx->written);
if (!ctx->written)
return 0;
- if (cli_updatelimits(ctx->ctx, ctx->written))
+ if (ctx->ctx && cli_updatelimits(ctx->ctx, ctx->written))
return -1;
ctx->written = 0;
lseek(ctx->outfd, 0, SEEK_SET);
cli_dbgmsg("bytecode: scanning extracted file %s\n", ctx->tempfile);
- res = cli_magic_scandesc(ctx->outfd, ctx->ctx);
- if (res == CL_VIRUS)
- ctx->found = 1;
cctx = (cli_ctx*)ctx->ctx;
+ if (cctx) {
+ res = cli_magic_scandesc(ctx->outfd, cctx);
+ if (res == CL_VIRUS)
+ ctx->found = 1;
+ }
if ((cctx && cctx->engine->keeptmp) ||
(ftruncate(ctx->outfd, 0) == -1)) {
diff --git a/libclamav/bytecode_vm.c b/libclamav/bytecode_vm.c
index 8afec84..49e6777 100644
--- a/libclamav/bytecode_vm.c
+++ b/libclamav/bytecode_vm.c
@@ -100,7 +100,7 @@ static always_inline int jump(const struct cli_bc_func *func, uint16_t bbid, str
return 0;
}
-#define STACK_CHUNKSIZE 32768
+#define STACK_CHUNKSIZE 65536
struct stack_chunk {
struct stack_chunk *prev;
@@ -143,7 +143,7 @@ static always_inline void* cli_stack_alloc(struct stack *stack, unsigned bytes)
}
if(bytes >= STACK_CHUNKSIZE) {
- cli_warnmsg("cli_stack_alloc: Attempt to allocate more than STACK_CHUNKSIZE bytes!\n");
+ cli_warnmsg("cli_stack_alloc: Attempt to allocate more than STACK_CHUNKSIZE bytes: %u!\n", bytes);
return NULL;
}
/* not enough room here, allocate new chunk */
@@ -800,7 +800,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
unsigned arg2;
/* check that arg2 is size of arg1 */
READ32(arg2, inst->u.ops.ops[1]);
- READP(arg1, inst->u.ops.ops[0], arg2);
+ READPOP(arg1, inst->u.ops.ops[0], arg2);
res32 = cli_apicalls1[api->idx](ctx, arg1, arg2);
WRITE32(inst->dest, res32);
break;
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list