[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:26:08 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 7f6b55a1247bb60a0a791720303d217eef1794b3
Author: Török Edvin <edwin at clamav.net>
Date:   Wed Mar 24 17:55:04 2010 +0200

    Downgrade some messages to debug.

diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c
index b0f04dc..d6d93b4 100644
--- a/libclamav/bytecode.c
+++ b/libclamav/bytecode.c
@@ -821,8 +821,8 @@ static void readConstant(struct cli_bc *bc, unsigned i, unsigned comp,
 	bc->globals[i][j++] = readNumber(buffer, offset, len, ok);
     }
     if (*ok && j != comp) {
-	cli_errmsg("bytecode: constant has too few subcomponents: %u < %u\n", j, comp);
-//	*ok = 0;
+	cli_dbgmsg("bytecode: constant has too few subcomponents: %u < %u\n", j, comp);
+/*	*ok = 0; */
     }
     (*offset)++;
 }
diff --git a/libclamav/bytecode_api.c b/libclamav/bytecode_api.c
index e6785f3..afaea1f 100644
--- a/libclamav/bytecode_api.c
+++ b/libclamav/bytecode_api.c
@@ -59,13 +59,15 @@ int32_t cli_bcapi_read(struct cli_bc_ctx* ctx, uint8_t *data, int32_t size)
     if (!ctx->fmap)
 	return -1;
     if (size < 0 || size > CLI_MAX_ALLOCATION) {
-	cli_errmsg("bytecode: negative read size: %d\n", size);
+	cli_warnmsg("bytecode: negative read size: %d\n", size);
 	return -1;
     }
 /*    cli_dbgmsg("read data at %d\n", ctx->off);*/
     n = fmap_readn(ctx->fmap, data, ctx->off, size);
-    if (n <= 0)
+    if (n <= 0) {
+	cli_dbgmsg("bcapi_read: fmap_readn failed\n");
 	return n;
+    }
     ctx->off += n;
     return n;
 }
@@ -73,8 +75,10 @@ int32_t cli_bcapi_read(struct cli_bc_ctx* ctx, uint8_t *data, int32_t size)
 int32_t cli_bcapi_seek(struct cli_bc_ctx* ctx, int32_t pos, uint32_t whence)
 {
     off_t off;
-    if (!ctx->fmap)
+    if (!ctx->fmap) {
+	cli_dbgmsg("bcapi_seek: no fmap\n");
 	return -1;
+    }
     switch (whence) {
 	case 0:
 	    off = pos;
@@ -86,8 +90,11 @@ int32_t cli_bcapi_seek(struct cli_bc_ctx* ctx, int32_t pos, uint32_t whence)
 	    off = ctx->file_size + pos;
 	    break;
     }
-    if (off < 0 || off > ctx->file_size)
+    if (off < 0 || off > ctx->file_size) {
+	cli_dbgmsg("bcapi_seek: out of file: %ld (max %d)\n",
+		   off, ctx->file_size);
 	return -1;
+    }
     ctx->off = off;
     return off;
 }
@@ -125,8 +132,10 @@ uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT *res,
     n = MIN(32, ctx->fmap->len - ctx->off);
     buf = fmap_need_off_once(ctx->fmap, ctx->off, n);
     next = cli_disasm_one(buf, n, res, 0);
-    if (!next)
+    if (!next) {
+	cli_dbgmsg("bcapi_disasm: failed\n");
 	return -1;
+    }
     return ctx->off + next - buf;
 }
 
@@ -162,7 +171,7 @@ int32_t cli_bcapi_write(struct cli_bc_ctx *ctx, uint8_t*data, int32_t len)
     res = cli_writen(ctx->outfd, data, len);
     if (res > 0) ctx->written += res;
     if (res == -1)
-	    cli_dbgmsg("Bytecode API: write failed: %d\n", errno);
+	cli_dbgmsg("Bytecode API: write failed: %d\n", errno);
     return res;
 }
 
@@ -274,8 +283,10 @@ uint32_t cli_bcapi_pe_rawaddr(struct cli_bc_ctx *ctx, uint32_t rva)
   const struct cli_pe_hook_data *pe = ctx->hooks.pedata;
   ret = cli_rawaddr(rva, ctx->sections, pe->nsections, &err,
 		    ctx->file_size, pe->hdr_size);
-  if (err)
+  if (err) {
+    cli_dbgmsg("bcapi_pe_rawaddr invalid rva: %u\n", rva);
     return PE_INVALID_RVA;
+  }
   return ret;
 }
 
@@ -311,8 +322,10 @@ int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx, const uint8_t* data, uint32_
     uint32_t off = ctx->off, newoff;
     int n;
 
-    if (!map || len > sizeof(buf)/4 || len <= 0)
+    if (!map || len > sizeof(buf)/4 || len <= 0) {
+	cli_dbgmsg("bcapi_file_find preconditions not met\n");
 	return -1;
+    }
     for (;;) {
 	const char *p;
 	n = fmap_readn(map, buf, off, sizeof(buf));
@@ -329,10 +342,14 @@ int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx, const uint8_t* data, uint32_
 int32_t cli_bcapi_file_byteat(struct cli_bc_ctx *ctx, uint32_t off)
 {
     unsigned char c;
-    if (!ctx->fmap)
+    if (!ctx->fmap) {
+	cli_dbgmsg("bcapi_file_byteat: no fmap\n");
 	return -1;
-    if (fmap_readn(ctx->fmap, &c, off, 1) != 1)
+    }
+    if (fmap_readn(ctx->fmap, &c, off, 1) != 1) {
+	cli_dbgmsg("bcapi_file_byteat: fmap_readn failed at %u\n", off);
 	return -1;
+    }
     return c;
 }
 
@@ -390,8 +407,10 @@ int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx, uint8_t* buf,
 	return -1;
     }
     res = cli_bcapi_read(ctx, buf+remaining, tofill);
-    if (res <= 0)
+    if (res <= 0) {
+	cli_dbgmsg("fill_buffer5\n");
 	return res;
+    }
     return remaining + res;
 }
 
diff --git a/libclamav/bytecode_nojit.c b/libclamav/bytecode_nojit.c
index e36555e..36319bc 100644
--- a/libclamav/bytecode_nojit.c
+++ b/libclamav/bytecode_nojit.c
@@ -39,7 +39,7 @@ int cli_bytecode_prepare_jit(struct cli_all_bc *bcs)
 	    return CL_EBYTECODE;
 	}
     }
-    cli_warnmsg("JIT not compiled in\n");
+    cli_dbgmsg("JIT not compiled in\n");
     return CL_EBYTECODE;
 }
 
diff --git a/libclamav/bytecode_vm.c b/libclamav/bytecode_vm.c
index ce22819..7029124 100644
--- a/libclamav/bytecode_vm.c
+++ b/libclamav/bytecode_vm.c
@@ -42,7 +42,7 @@
 static int never_inline bcfail(const char *msg, long a, long b,
 		  const char *file, unsigned line)
 {
-    cli_errmsg("bytecode: check failed %s (%lx and %lx) at %s:%u\n", msg, a, b, file, line);
+    cli_warnmsg("bytecode: check failed %s (%lx and %lx) at %s:%u\n", msg, a, b, file, line);
     return CL_EARG;
 }
 
@@ -131,7 +131,7 @@ static always_inline void* cli_stack_alloc(struct stack *stack, unsigned bytes)
     }
 
     if(bytes >= STACK_CHUNKSIZE) {
-	cli_errmsg("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!\n");
 	return NULL;
     }
     /* not enough room here, allocate new chunk */
@@ -153,17 +153,17 @@ static always_inline void cli_stack_free(struct stack *stack, void *data)
     uint16_t last_size;
     struct stack_chunk *chunk = stack->chunk;
     if (!chunk) {
-	cli_errmsg("cli_stack_free: stack empty!\n");
+	cli_warnmsg("cli_stack_free: stack empty!\n");
 	return;
     }
     if ((chunk->u.data + chunk->used) != ((char*)data + stack->last_size*sizeof(align_t))) {
-	cli_errmsg("cli_stack_free: wrong free order: %p, expected %p\n",
+	cli_warnmsg("cli_stack_free: wrong free order: %p, expected %p\n",
 		   data, chunk->u.data + chunk->used - stack->last_size*sizeof(align_t));
 	return;
     }
     last_size = *(uint16_t*)&chunk->u.data[chunk->used-2];
     if (chunk->used < stack->last_size*sizeof(align_t)) {
-	cli_errmsg("cli_stack_free: last_size is corrupt!\n");
+	cli_warnmsg("cli_stack_free: last_size is corrupt!\n");
 	return;
     }
     chunk->used -= stack->last_size*sizeof(align_t);
@@ -622,7 +622,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
 	    if (tv1.tv_sec > timeout.tv_sec ||
 		(tv1.tv_sec == timeout.tv_sec &&
 		 tv1.tv_usec > timeout.tv_usec)) {
-		cli_errmsg("Bytecode run timed out in interpreter\n");
+		cli_warnmsg("Bytecode run timed out in interpreter\n");
 		stop = CL_ETIMEOUT;
 		break;
 	    }
@@ -816,7 +816,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
 			break;
 		    }
 		    default:
-			cli_errmsg("bytecode: type %u apicalls not yet implemented!\n", api->kind);
+			cli_warnmsg("bytecode: type %u apicalls not yet implemented!\n", api->kind);
 			stop = CL_EBYTECODE;
 		}
 		WRITE32(inst->dest, res);
@@ -838,7 +838,7 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
 		/* 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");
+		    cli_warnmsg("bytecode: stack depth exceeded\n");
 		    stop = CL_EBYTECODE;
 		    break;
 		}

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list