[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:00 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 1678ef9e43b459d4415ef9593fa37d1b4f7ec633
Author: Török Edvin <edwin at clamav.net>
Date: Mon Mar 29 11:38:52 2010 +0300
Fix inflate.cbc for the interpreter.
diff --git a/libclamav/bytecode_vm.c b/libclamav/bytecode_vm.c
index 3dca85d..ea6779a 100644
--- a/libclamav/bytecode_vm.c
+++ b/libclamav/bytecode_vm.c
@@ -74,11 +74,13 @@ static inline int bcfail(const char *msg, long a, long b,
#define TRACE_R(x) cli_dbgmsg("bytecode trace: %u, read %llx\n", pc, (long long)x);
#define TRACE_W(x, w, p) cli_dbgmsg("bytecode trace: %u, write%d @%u %llx\n", pc, p, w, (long long)(x));
#define TRACE_EXEC(id, dest, ty, stack) cli_dbgmsg("bytecode trace: executing %d, -> %u (%u); %u\n", id, dest, ty, stack)
+#define TRACE_API(s, dest, ty, stack) cli_dbgmsg("bytecode trace: executing %s, -> %u (%u); %u\n", s, dest, ty, stack)
#else
#define CHECK_UNREACHABLE return CL_EBYTECODE
#define TRACE_R(x)
#define TRACE_W(x, w, p)
#define TRACE_EXEC(id, dest, ty, stack)
+#define TRACE_API(s, dest, ty, stack)
#endif
#define SIGNEXT(a, from) CLI_SRS(((int64_t)(a)) << (64-(from)), (64-(from)))
@@ -561,7 +563,7 @@ static inline void* ptr_torealptr(const struct ptr_infos *infos, int64_t ptr,
info = &infos->glob_infos[ptrid];
}
if (LIKELY(ptroff < info->size &&
- read_size < info->size &&
+ read_size <= info->size &&
ptroff + read_size <= info->size)) {
return info->base+ptroff;
}
@@ -768,15 +770,17 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
DEFINE_OP(OP_BC_CALL_API) {
const struct cli_apicall *api = &cli_apicalls[inst->u.ops.funcid];
- int32_t res;
+ int32_t res32;
+ int64_t res64;
CHECK_APIID(inst->u.ops.funcid);
- TRACE_EXEC(-inst->u.ops.funcid, inst->dest, inst->type, stack_depth);
+ TRACE_API(api->name, inst->dest, inst->type, stack_depth);
switch (api->kind) {
case 0: {
int32_t a, b, r;
READ32(a, inst->u.ops.ops[0]);
READ32(b, inst->u.ops.ops[1]);
- res = cli_apicalls0[api->idx](ctx, a, b);
+ res32 = cli_apicalls0[api->idx](ctx, a, b);
+ WRITE32(inst->dest, res32);
break;
}
case 1: {
@@ -785,13 +789,15 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
/* check that arg2 is size of arg1 */
READ32(arg2, inst->u.ops.ops[1]);
READP(arg1, inst->u.ops.ops[0], arg2);
- res = cli_apicalls1[api->idx](ctx, arg1, arg2);
+ res32 = cli_apicalls1[api->idx](ctx, arg1, arg2);
+ WRITE32(inst->dest, res32);
break;
}
case 2: {
int32_t a;
READ32(a, inst->u.ops.ops[0]);
- res = cli_apicalls2[api->idx](ctx, a);
+ res32 = cli_apicalls2[api->idx](ctx, a);
+ WRITE32(inst->dest, res32);
break;
}
case 3: {
@@ -799,7 +805,8 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
void *resp;
READ32(a, inst->u.ops.ops[0]);
resp = cli_apicalls3[api->idx](ctx, a);
- res = ptr_register_glob(&ptrinfos, resp, a);
+ res64 = ptr_register_glob(&ptrinfos, resp, a);
+ WRITE64(inst->dest, res64);
break;
}
case 4: {
@@ -810,11 +817,13 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
READ32(arg3, inst->u.ops.ops[2]);
READ32(arg4, inst->u.ops.ops[3]);
READ32(arg5, inst->u.ops.ops[4]);
- res = cli_apicalls4[api->idx](ctx, arg1, arg2, arg3, arg4, arg5);
+ res32 = cli_apicalls4[api->idx](ctx, arg1, arg2, arg3, arg4, arg5);
+ WRITE32(inst->dest, res32);
break;
}
case 5: {
- res = cli_apicalls5[api->idx](ctx);
+ res32 = cli_apicalls5[api->idx](ctx);
+ WRITE32(inst->dest, res32);
break;
}
case 6: {
@@ -823,7 +832,8 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
READ32(arg1, inst->u.ops.ops[0]);
READ32(arg2, inst->u.ops.ops[1]);
resp = cli_apicalls6[api->idx](ctx, arg1, arg2);
- res = ptr_register_glob(&ptrinfos, resp, arg2);
+ res64 = ptr_register_glob(&ptrinfos, resp, arg2);
+ WRITE64(inst->dest, res64);
break;
}
case 7: {
@@ -831,14 +841,14 @@ int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct
READ32(arg1, inst->u.ops.ops[0]);
READ32(arg2, inst->u.ops.ops[1]);
READ32(arg3, inst->u.ops.ops[2]);
- res = cli_apicalls7[api->idx](ctx, arg1, arg2, arg3);
+ res32 = cli_apicalls7[api->idx](ctx, arg1, arg2, arg3);
+ WRITE32(inst->dest, res32);
break;
}
default:
cli_warnmsg("bytecode: type %u apicalls not yet implemented!\n", api->kind);
stop = CL_EBYTECODE;
}
- WRITE32(inst->dest, res);
break;
}
diff --git a/unit_tests/check_bytecode.c b/unit_tests/check_bytecode.c
index c00f214..6c10a02 100644
--- a/unit_tests/check_bytecode.c
+++ b/unit_tests/check_bytecode.c
@@ -221,9 +221,8 @@ END_TEST
START_TEST (test_inflate)
{
cl_init(CL_INIT_DEFAULT);
- if (have_clamjit)
- runtest("input/inflate.cbc", 0xbeef, 0, 0, NULL, NULL, NULL, NULL);
-// runtest("input/inflate.cbc", 0xbeef, 0, 1, NULL, NULL, NULL, NULL);
+ runtest("input/inflate.cbc", 0xbeef, 0, 0, NULL, NULL, NULL, NULL);
+ runtest("input/inflate.cbc", 0xbeef, 0, 1, NULL, NULL, NULL, NULL);
}
END_TEST
diff --git a/unit_tests/input/inflate.cbc b/unit_tests/input/inflate.cbc
index e67157e..db1e3b8 100644
--- a/unit_tests/input/inflate.cbc
+++ b/unit_tests/input/inflate.cbc
@@ -1,12 +1,12 @@
-ClamBCafhom`cjjkd|afefdfggifnf```````|bhacflfafmfbfcfmb`cnbac`cmbacdcmbgfffdfbcafbfafbc``baaaap`clamcoincidencejb:444
+ClamBCafhdhff`kkd|afefdfggifnf```````|bjacflfafmfbfcfmb`cnbac`cmbdcicdc`cmbgfffhcafafacgcbf``baaaap`clamcoincidencejb:444
-Tedeb`eebodebadaaa`aabb`bb`baacbadb`bb`baacb`bb`bb`baadb`bb`bb`bb`baadb`bbadbadb`baae`badbadb`bb`bdafahdblaah
+Tedeb`eebodebadaaa`aabb`bb`baacbadb`bb`baacb`bb`bb`baadb`bb`bb`bb`baadb`bbadbadb`baae`badbadb`bb`bdaeahdblaah
Ebibaibnabid|b`abfegffffefbgoe`gif`gefoenfefgg``b`bbid|bgabfegffffefbgoe`gif`gefoebgefafdfoeaffgafiflf``bcbbid|bhabfegffffefbgoe`gif`gefoeggbgifdgefoeaffgafiflf``bibbid|amifnffflfafdgefoedfofnfef``bhbbid|b`aifnffflfafdgefoe`gbgofcfefcgcg``babbjd|beabfegffffefbgoe`gif`gefoebgefafdfoegfefdg``bdbbjd|bfabfegffffefbgoe`gif`gefoeggbgifdgefoegfefdg``bebbkd|bjabfegffffefbgoe`gif`gefoeggbgifdgefoecgdgof`g`gefdf``bgbbld|amifnffflfafdgefoeifnfifdg``
-G`ae`@`b`eBoaBkhAhAhB`jBjaBejBkd at AcBffBofBof@BkbBidBmbBnbAa at AlBngBogBhmAd@@@`bodBdgBefBcgBdgBkc@`bad at Aa`bad at Ab`
+G`ae`@`b`eBoaBkhAhAhB`jBjaBejBkd at AcBffBofBof@BkbBidBmbBnbAa at AlBngBogBhmAd@@@`bodBdgBefBcgBdg@`bad at Aa`bad at Ab`
A`b`bLbfab`bab`b`b`b`aa`aa`aa```b`b`bad```b`b`b`b`aa```b`b`b`b`bad`b`b`aa```b`b`b`b`Fbjaae
-Bb`baaababnaD```adb`babababnaD```adaaacnab`baa at daaadnab`bab at daaael`adac``bbEamjnmd`Taaaeadaa
+Bb`baaababnaD```adb`babababnaD```adaaacnab`baa at daaadnab`bab at daaael`acad``bbEamjnmd`Taaaeadaa
Bb`bagababcbaabadahabbbdbaaag``ibahAc`Bladb`bajabbbebaaBladb`bakabcbgbaaabBoadaaalnab`bak at d``bbEbmjnmd`Taaaladab
-Bb`banababhbakb`baoabab`babbadb`aabbbababaob`bbaakbb`aAd`Aedaabbaeab`bbaa at d``bbEcmjnmd`Taabbaacad
+Bb`banababhbakb`baoabab`babbadb`aabbbababaob`bbaakbb`aAd`Addaabbaeab`bbaa at d``bbEcmjnmd`Taabbaacad
Bb`bbdaababibakTcab`bDonnkd
Bb`bbeabb`beaTcab`bbeaE
Scgdgafdgifcf`bcfofnfcgdg`begifnfdghcoedg`bifnf`gegdgkeme`bmc`bkgS`chgacfflb`b`chghcbflb`b`chg`chclb`b`chg`chclb`b`chgaf`clb`b`chgacaflb`b`chgafeclb`b`chgdcbflb`b`chg`c`clb`b`chg`ccclb`b`chgfcfclb`b`chgfcfflb
@@ -17,4 +17,4 @@ affgafiflf`bmc`bbfegffffefbgoe`gif`gefoeggbgifdgefoeaffgafiflfhbifnf`gegdgoebfeg
mfefmfcf`gighbifnf`gegdgoebflb`bifnf`gegdglb`bcgifjgefofffhbifnf`gegdgibibkcSbfegffffefbgoe`gif`gefoeggbgifdgefoecgdgof`g`gefdfhbifnf`gegdgoebfegfflb`bcgifjgefofffhbifnf`gegdgibibkc
Sifnfdgccbcoedg`bifdf`bmc`bifnffflfafdgefoeifnfifdghbifnf`gegdgoebfegfflb`bofegdg`gegdgoebfegfflb`bccacibkcSifff`bhbifdf`blc`b`cibSbgefdgegbgnf`b`chgdfefafdfbckcSifnffflfafdgefoe`gbgofcfefcgcghbifdfibkc
affgafiflf`bmc`bbfegffffefbgoe`gif`gefoebgefafdfoeaffgafiflfhbofegdg`gegdgoebfegffibkcSofegdgoebf`bmc`bbfegffffefbgoe`gif`gefoebgefafdfoegfefdghbofegdg`gegdgoebfegfflb`baffgafiflfibkc
-ifff`bhbmfefmfcfmf`ghbofegdgoebflb`bbbdgefcgdgkcbblb`becibibSbgefdgegbgnf`b`chgdfefafdfcckcSifnffflfafdgefoedfofnfefhbifdfibkcSbgefdgegbgnf`b`chgbfefefffkcSmgSS
\ No newline at end of file
+ifff`bhbmfefmfcfmf`ghbofegdgoebflb`bbbdgefcgdgbblb`bdcibibSbgefdgegbgnf`b`chgdfefafdfcckcSifnffflfafdgefoedfofnfefhbifdfibkcSbgefdgegbgnf`b`chgbfefefffkcSmgSS
\ No newline at end of file
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list