[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:23:31 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 75e18b29c26efccb8051553a41528addab9c1895
Author: Török Edvin <edwin at clamav.net>
Date:   Sat Mar 20 21:18:54 2010 +0200

    minimalistic zlib api.

diff --git a/libclamav/bytecode_api.c b/libclamav/bytecode_api.c
index 34e9d3c..7b97efd 100644
--- a/libclamav/bytecode_api.c
+++ b/libclamav/bytecode_api.c
@@ -429,7 +429,7 @@ int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx, uint32_t radix)
 {
     unsigned char number[16];
     unsigned i;
-    unsigned char *p;
+    char *p;
     int32_t result;
 
     if (radix != 10 && radix != 16 || !ctx->fmap)
@@ -437,7 +437,7 @@ int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx, uint32_t radix)
     while ((p = fmap_need_off_once(ctx->fmap, ctx->off, BUF))) {
 	for (i=0;i<BUF;i++) {
 	    if (p[i] >= '0' && p[i] <= '9') {
-		unsigned char *endptr;
+		char *endptr;
 		p = fmap_need_ptr_once(ctx->fmap, p+i, 16);
 		if (!p)
 		    return -1;
@@ -451,3 +451,53 @@ int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx, uint32_t radix)
     return -1;
 }
 
+int32_t cli_bcapi_hashset_new(struct cli_bc_ctx *ctx )
+{
+}
+int32_t cli_bcapi_hashset_add(struct cli_bc_ctx *ctx , int32_t id, uint32_t key)
+{
+}
+int32_t cli_bcapi_hashset_remove(struct cli_bc_ctx *ctx , int32_t id, uint32_t key)
+{
+}
+int32_t cli_bcapi_hashset_contains(struct cli_bc_ctx *ctx , int32_t id, uint32_t key)
+{
+}
+int32_t cli_bcapi_hashset_done(struct cli_bc_ctx *ctx , int32_t id)
+{
+}
+
+int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx)
+{
+    z_stream *s;
+    s = cli_realloc(ctx->z_streams, (ctx->z_nstreams+1)*sizeof(*ctx->z_streams));
+    if (!s)
+	return -1;
+    ctx->z_streams = s;
+    ctx->z_nstreams++;
+    s = &s[ctx->z_nstreams-1];
+    memset(s, 0, sizeof(*s));
+    return inflateInit2(s, MAX_WBITS+16);
+}
+
+int32_t cli_bcapi_inflate_process(struct cli_bc_ctx *ctx , int32_t id,
+				  uint8_t* in, uint32_t in_size,
+				  uint8_t* out, uint32_t out_size)
+{
+    if (id >= ctx->z_nstreams)
+	return -1;
+    z_stream *s = &ctx->z_streams[id];
+    s->next_in = in;
+    s->avail_in = in_size;
+    s->next_out = out;
+    s->avail_out = out_size;
+    return inflate(s, 0);
+}
+
+int32_t cli_bcapi_inflate_done(struct cli_bc_ctx *ctx , int32_t id)
+{
+    if (id >= ctx->z_nstreams)
+	return -1;
+    z_stream *s = &ctx->z_streams[id];
+    return inflateEnd(s);
+}
diff --git a/libclamav/bytecode_api.h b/libclamav/bytecode_api.h
index 6aa31fb..7fafe1b 100644
--- a/libclamav/bytecode_api.h
+++ b/libclamav/bytecode_api.h
@@ -224,5 +224,16 @@ int32_t extract_new(int32_t id);
   */
 int32_t read_number(uint32_t radix);
 
+int32_t hashset_new(void);
+int32_t hashset_add(int32_t hs, uint32_t key);
+int32_t hashset_remove(int32_t hs, uint32_t key);
+int32_t hashset_contains(int32_t hs, uint32_t key);
+int32_t hashset_done(int32_t id);
+
+int32_t inflate_init(void);
+int32_t inflate_process(int32_t id, uint8_t *input, uint32_t input_size,
+                        uint8_t *output, uint32_t output_size);
+int32_t inflate_done(int32_t id);
+
 #endif
 #endif
diff --git a/libclamav/bytecode_api_decl.c b/libclamav/bytecode_api_decl.c
index 4e9dd77..85447a8 100644
--- a/libclamav/bytecode_api_decl.c
+++ b/libclamav/bytecode_api_decl.c
@@ -33,29 +33,37 @@
 #include "bytecode_priv.h"
 #include <stdlib.h>
 
-uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx, uint32_t, uint32_t);
-int32_t cli_bcapi_read(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
-int32_t cli_bcapi_write(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
-int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx, int32_t, uint32_t);
-uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx, uint32_t);
-uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT*, uint32_t);
-uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_ptr(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_pe_rawaddr(struct cli_bc_ctx *ctx, uint32_t);
-int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-int32_t cli_bcapi_file_byteat(struct cli_bc_ctx *ctx, uint32_t);
-uint8_t* cli_bcapi_malloc(struct cli_bc_ctx *ctx, uint32_t);
-uint32_t cli_bcapi_test2(struct cli_bc_ctx *ctx, uint32_t);
-int32_t cli_bcapi_get_pe_section(struct cli_bc_ctx *ctx, struct cli_exe_section*, uint32_t);
-int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx, uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t);
-int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx, int32_t);
-int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx, uint32_t);
+uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx , uint32_t, uint32_t);
+int32_t cli_bcapi_read(struct cli_bc_ctx *ctx , uint8_t*, int32_t);
+int32_t cli_bcapi_write(struct cli_bc_ctx *ctx , uint8_t*, int32_t);
+int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx , uint32_t);
+uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx , struct DISASM_RESULT*, uint32_t);
+uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_ptr(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_pe_rawaddr(struct cli_bc_ctx *ctx , uint32_t);
+int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+int32_t cli_bcapi_file_byteat(struct cli_bc_ctx *ctx , uint32_t);
+uint8_t* cli_bcapi_malloc(struct cli_bc_ctx *ctx , uint32_t);
+uint32_t cli_bcapi_test2(struct cli_bc_ctx *ctx , uint32_t);
+int32_t cli_bcapi_get_pe_section(struct cli_bc_ctx *ctx , struct cli_exe_section*, uint32_t);
+int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx , uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t);
+int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx , int32_t);
+int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx , uint32_t);
+int32_t cli_bcapi_hashset_new(struct cli_bc_ctx *ctx );
+int32_t cli_bcapi_hashset_add(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+int32_t cli_bcapi_hashset_remove(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+int32_t cli_bcapi_hashset_contains(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+int32_t cli_bcapi_hashset_done(struct cli_bc_ctx *ctx , int32_t);
+int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx );
+int32_t cli_bcapi_inflate_process(struct cli_bc_ctx *ctx , int32_t, uint8_t*, uint32_t, uint8_t*, uint32_t);
+int32_t cli_bcapi_inflate_done(struct cli_bc_ctx *ctx , int32_t);
 
 const struct cli_apiglobal cli_globals[] = {
 /* Bytecode globals BEGIN */
@@ -79,19 +87,21 @@ static uint16_t cli_tmp5[]={32, 16, 16, 32, 32, 32, 16, 16};
 static uint16_t cli_tmp6[]={32};
 static uint16_t cli_tmp7[]={32};
 static uint16_t cli_tmp8[]={32, 32};
-static uint16_t cli_tmp9[]={32, 65, 32, 32, 32, 32};
-static uint16_t cli_tmp10[]={32, 80, 32};
-static uint16_t cli_tmp11[]={81};
-static uint16_t cli_tmp12[]={32, 32, 32, 32, 32, 32, 32, 32, 32};
-static uint16_t cli_tmp13[]={65, 32};
-static uint16_t cli_tmp14[]={32, 65, 32};
-static uint16_t cli_tmp15[]={32, 85, 32};
-static uint16_t cli_tmp16[]={86};
-static uint16_t cli_tmp17[]={16, 8, 8, 8, 88, 87};
-static uint16_t cli_tmp18[]={8};
+static uint16_t cli_tmp9[]={32, 32, 65, 32, 65, 32};
+static uint16_t cli_tmp10[]={32};
+static uint16_t cli_tmp11[]={32, 32, 32};
+static uint16_t cli_tmp12[]={32, 65, 32, 32, 32, 32};
+static uint16_t cli_tmp13[]={32, 83, 32};
+static uint16_t cli_tmp14[]={84};
+static uint16_t cli_tmp15[]={32, 32, 32, 32, 32, 32, 32, 32, 32};
+static uint16_t cli_tmp16[]={65, 32};
+static uint16_t cli_tmp17[]={32, 65, 32};
+static uint16_t cli_tmp18[]={32, 88, 32};
 static uint16_t cli_tmp19[]={89};
-static uint16_t cli_tmp20[]={8};
-static uint16_t cli_tmp21[]={32, 32, 32};
+static uint16_t cli_tmp20[]={16, 8, 8, 8, 91, 90};
+static uint16_t cli_tmp21[]={8};
+static uint16_t cli_tmp22[]={92};
+static uint16_t cli_tmp23[]={8};
 
 const struct cli_bc_type cli_apicall_types[]={
 	{DStructType, cli_tmp0, 11, 0, 0},
@@ -104,51 +114,64 @@ const struct cli_bc_type cli_apicall_types[]={
 	{DArrayType, cli_tmp7, 64, 0, 0},
 	{DFunctionType, cli_tmp8, 2, 0, 0},
 	{DFunctionType, cli_tmp9, 6, 0, 0},
-	{DFunctionType, cli_tmp10, 3, 0, 0},
-	{DPointerType, cli_tmp11, 1, 0, 0},
-	{DStructType, cli_tmp12, 9, 0, 0},
-	{DFunctionType, cli_tmp13, 2, 0, 0},
-	{DFunctionType, cli_tmp14, 3, 0, 0},
-	{DFunctionType, cli_tmp15, 3, 0, 0},
-	{DPointerType, cli_tmp16, 1, 0, 0},
-	{DStructType, cli_tmp17, 6, 0, 0},
-	{DArrayType, cli_tmp18, 29, 0, 0},
-	{DArrayType, cli_tmp19, 3, 0, 0},
-	{DArrayType, cli_tmp20, 10, 0, 0},
-	{DFunctionType, cli_tmp21, 3, 0, 0}
+	{DFunctionType, cli_tmp10, 1, 0, 0},
+	{DFunctionType, cli_tmp11, 3, 0, 0},
+	{DFunctionType, cli_tmp12, 6, 0, 0},
+	{DFunctionType, cli_tmp13, 3, 0, 0},
+	{DPointerType, cli_tmp14, 1, 0, 0},
+	{DStructType, cli_tmp15, 9, 0, 0},
+	{DFunctionType, cli_tmp16, 2, 0, 0},
+	{DFunctionType, cli_tmp17, 3, 0, 0},
+	{DFunctionType, cli_tmp18, 3, 0, 0},
+	{DPointerType, cli_tmp19, 1, 0, 0},
+	{DStructType, cli_tmp20, 6, 0, 0},
+	{DArrayType, cli_tmp21, 29, 0, 0},
+	{DArrayType, cli_tmp22, 3, 0, 0},
+	{DArrayType, cli_tmp23, 10, 0, 0}
 };
 
 const unsigned cli_apicall_maxtypes=sizeof(cli_apicall_types)/sizeof(cli_apicall_types[0]);
 const struct cli_apicall cli_apicalls[]={
 /* Bytecode APIcalls BEGIN */
-	{"test1", 21, 0, 0},
-	{"read", 14, 0, 1},
-	{"write", 14, 1, 1},
-	{"seek", 21, 1, 0},
-	{"setvirusname", 14, 2, 1},
-	{"debug_print_str", 14, 3, 1},
+	{"test1", 11, 0, 0},
+	{"read", 17, 0, 1},
+	{"write", 17, 1, 1},
+	{"seek", 11, 1, 0},
+	{"setvirusname", 17, 2, 1},
+	{"debug_print_str", 17, 3, 1},
 	{"debug_print_uint", 8, 0, 2},
-	{"disasm_x86", 15, 4, 1},
-	{"trace_directory", 14, 5, 1},
-	{"trace_scope", 14, 6, 1},
-	{"trace_source", 14, 7, 1},
-	{"trace_op", 14, 8, 1},
-	{"trace_value", 14, 9, 1},
-	{"trace_ptr", 14, 10, 1},
+	{"disasm_x86", 18, 4, 1},
+	{"trace_directory", 17, 5, 1},
+	{"trace_scope", 17, 6, 1},
+	{"trace_source", 17, 7, 1},
+	{"trace_op", 17, 8, 1},
+	{"trace_value", 17, 9, 1},
+	{"trace_ptr", 17, 10, 1},
 	{"pe_rawaddr", 8, 1, 2},
-	{"file_find", 14, 11, 1},
+	{"file_find", 17, 11, 1},
 	{"file_byteat", 8, 2, 2},
-	{"malloc", 13, 0, 3},
+	{"malloc", 16, 0, 3},
 	{"test2", 8, 3, 2},
-	{"get_pe_section", 10, 12, 1},
-	{"fill_buffer", 9, 0, 4},
+	{"get_pe_section", 13, 12, 1},
+	{"fill_buffer", 12, 0, 4},
 	{"extract_new", 8, 4, 2},
-	{"read_number", 8, 5, 2}
+	{"read_number", 8, 5, 2},
+	{"hashset_new", 10, 0, 5},
+	{"hashset_add", 11, 2, 0},
+	{"hashset_remove", 11, 3, 0},
+	{"hashset_contains", 11, 4, 0},
+	{"hashset_done", 8, 6, 2},
+	{"inflate_init", 10, 1, 5},
+	{"inflate_process", 9, 0, 6},
+	{"inflate_done", 8, 7, 2}
 /* Bytecode APIcalls END */
 };
 const cli_apicall_int2 cli_apicalls0[] = {
 	(cli_apicall_int2)cli_bcapi_test1,
-	(cli_apicall_int2)cli_bcapi_seek
+	(cli_apicall_int2)cli_bcapi_seek,
+	(cli_apicall_int2)cli_bcapi_hashset_add,
+	(cli_apicall_int2)cli_bcapi_hashset_remove,
+	(cli_apicall_int2)cli_bcapi_hashset_contains
 };
 const cli_apicall_pointer cli_apicalls1[] = {
 	(cli_apicall_pointer)cli_bcapi_read,
@@ -171,7 +194,9 @@ const cli_apicall_int1 cli_apicalls2[] = {
 	(cli_apicall_int1)cli_bcapi_file_byteat,
 	(cli_apicall_int1)cli_bcapi_test2,
 	(cli_apicall_int1)cli_bcapi_extract_new,
-	(cli_apicall_int1)cli_bcapi_read_number
+	(cli_apicall_int1)cli_bcapi_read_number,
+	(cli_apicall_int1)cli_bcapi_hashset_done,
+	(cli_apicall_int1)cli_bcapi_inflate_done
 };
 const cli_apicall_malloclike cli_apicalls3[] = {
 	(cli_apicall_malloclike)cli_bcapi_malloc
@@ -179,4 +204,11 @@ const cli_apicall_malloclike cli_apicalls3[] = {
 const cli_apicall_ptrbuffdata cli_apicalls4[] = {
 	(cli_apicall_ptrbuffdata)cli_bcapi_fill_buffer
 };
+const cli_apicall_allocobj cli_apicalls5[] = {
+	(cli_apicall_allocobj)cli_bcapi_hashset_new,
+	(cli_apicall_allocobj)cli_bcapi_inflate_init
+};
+const cli_apicall_bufops cli_apicalls6[] = {
+	(cli_apicall_bufops)cli_bcapi_inflate_process
+};
 const unsigned cli_apicall_maxapi = sizeof(cli_apicalls)/sizeof(cli_apicalls[0]);
diff --git a/libclamav/bytecode_api_impl.h b/libclamav/bytecode_api_impl.h
index 262d4ba..733f253 100644
--- a/libclamav/bytecode_api_impl.h
+++ b/libclamav/bytecode_api_impl.h
@@ -30,28 +30,36 @@
 #define BYTECODE_API_IMPL_H
 
 struct cli_bc_bctx;
-uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx, uint32_t, uint32_t);
-int32_t cli_bcapi_read(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
-int32_t cli_bcapi_write(struct cli_bc_ctx *ctx, uint8_t*, int32_t);
-int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx, int32_t, uint32_t);
-uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx, uint32_t);
-uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT*, uint32_t);
-uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_trace_ptr(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-uint32_t cli_bcapi_pe_rawaddr(struct cli_bc_ctx *ctx, uint32_t);
-int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx, const uint8_t*, uint32_t);
-int32_t cli_bcapi_file_byteat(struct cli_bc_ctx *ctx, uint32_t);
-uint8_t* cli_bcapi_malloc(struct cli_bc_ctx *ctx, uint32_t);
-uint32_t cli_bcapi_test2(struct cli_bc_ctx *ctx, uint32_t);
-int32_t cli_bcapi_get_pe_section(struct cli_bc_ctx *ctx, struct cli_exe_section*, uint32_t);
-int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx, uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t);
-int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx, int32_t);
-int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx, uint32_t);
+uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx , uint32_t, uint32_t);
+int32_t cli_bcapi_read(struct cli_bc_ctx *ctx , uint8_t*, int32_t);
+int32_t cli_bcapi_write(struct cli_bc_ctx *ctx , uint8_t*, int32_t);
+int32_t cli_bcapi_seek(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_debug_print_str(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_debug_print_uint(struct cli_bc_ctx *ctx , uint32_t);
+uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx , struct DISASM_RESULT*, uint32_t);
+uint32_t cli_bcapi_trace_directory(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_scope(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_source(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_op(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_value(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_trace_ptr(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+uint32_t cli_bcapi_pe_rawaddr(struct cli_bc_ctx *ctx , uint32_t);
+int32_t cli_bcapi_file_find(struct cli_bc_ctx *ctx , const uint8_t*, uint32_t);
+int32_t cli_bcapi_file_byteat(struct cli_bc_ctx *ctx , uint32_t);
+uint8_t* cli_bcapi_malloc(struct cli_bc_ctx *ctx , uint32_t);
+uint32_t cli_bcapi_test2(struct cli_bc_ctx *ctx , uint32_t);
+int32_t cli_bcapi_get_pe_section(struct cli_bc_ctx *ctx , struct cli_exe_section*, uint32_t);
+int32_t cli_bcapi_fill_buffer(struct cli_bc_ctx *ctx , uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t);
+int32_t cli_bcapi_extract_new(struct cli_bc_ctx *ctx , int32_t);
+int32_t cli_bcapi_read_number(struct cli_bc_ctx *ctx , uint32_t);
+int32_t cli_bcapi_hashset_new(struct cli_bc_ctx *ctx );
+int32_t cli_bcapi_hashset_add(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+int32_t cli_bcapi_hashset_remove(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+int32_t cli_bcapi_hashset_contains(struct cli_bc_ctx *ctx , int32_t, uint32_t);
+int32_t cli_bcapi_hashset_done(struct cli_bc_ctx *ctx , int32_t);
+int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx );
+int32_t cli_bcapi_inflate_process(struct cli_bc_ctx *ctx , int32_t, uint8_t*, uint32_t, uint8_t*, uint32_t);
+int32_t cli_bcapi_inflate_done(struct cli_bc_ctx *ctx , int32_t);
 
 #endif
diff --git a/libclamav/bytecode_priv.h b/libclamav/bytecode_priv.h
index 85ba180..eda35f6 100644
--- a/libclamav/bytecode_priv.h
+++ b/libclamav/bytecode_priv.h
@@ -23,6 +23,7 @@
 #ifndef BYTECODE_PRIV_H
 #define BYTECODE_PRIV_H
 
+#include <zlib.h>
 #include "bytecode.h"
 #include "type_desc.h"
 #include "execs.h"
@@ -151,6 +152,8 @@ struct cli_bc_ctx {
     mpool_t *mpool;
     uint32_t numGlobals;
     uint8_t* globals;
+    z_stream* z_streams;
+    unsigned z_nstreams;
 };
 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/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp
index 3cb4815..03537bd 100644
--- a/libclamav/c++/bytecode2llvm.cpp
+++ b/libclamav/c++/bytecode2llvm.cpp
@@ -1402,6 +1402,12 @@ int cli_bytecode_prepare_jit(struct cli_all_bc *bcs)
 		case 4:
 		    dest = (void*)(intptr_t)cli_apicalls4[api->idx];
 		    break;
+		case 5:
+		    dest = (void*)(intptr_t)cli_apicalls5[api->idx];
+		    break;
+		case 6:
+		    dest = (void*)(intptr_t)cli_apicalls6[api->idx];
+		    break;
 		default:
 		    llvm_unreachable("invalid api type");
 	    }
diff --git a/libclamav/type_desc.h b/libclamav/type_desc.h
index d9cf85d..1addb68 100644
--- a/libclamav/type_desc.h
+++ b/libclamav/type_desc.h
@@ -46,6 +46,8 @@ typedef uint32_t (*cli_apicall_pointer)(struct cli_bc_ctx *, void*, uint32_t);
 typedef uint32_t (*cli_apicall_int1)(struct cli_bc_ctx *, uint32_t);
 typedef void* (*cli_apicall_malloclike)(struct cli_bc_ctx *, uint32_t);
 typedef void* (*cli_apicall_ptrbuffdata)(struct cli_bc_ctx *, void*, uint32_t, uint32_t, uint32_t, uint32_t);
+typedef int32_t (*cli_apicall_allocobj)(struct cli_bc_ctx *);
+typedef int32_t (*cli_apicall_bufops)(struct cli_bc_ctx *, int32_t, void*, uint32_t, void*, uint32_t);
 
 struct cli_apicall {
     const char *name;
@@ -75,6 +77,8 @@ extern const cli_apicall_pointer cli_apicalls1[];
 extern const cli_apicall_int1 cli_apicalls2[];
 extern const cli_apicall_malloclike cli_apicalls3[];
 extern const cli_apicall_ptrbuffdata cli_apicalls4[];
+extern const cli_apicall_allocobj cli_apicalls5[];
+extern const cli_apicall_bufops cli_apicalls6[];
 extern const unsigned cli_apicall_maxapi;
 extern const unsigned cli_apicall_maxglobal;
 

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list