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


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

    Fix more leaks.

diff --git a/libclamav/bytecode.c b/libclamav/bytecode.c
index a569f11..b0f04dc 100644
--- a/libclamav/bytecode.c
+++ b/libclamav/bytecode.c
@@ -91,12 +91,17 @@ int cli_bytecode_context_getresult_file(struct cli_bc_ctx *ctx, char **tempfilen
 /* resets bytecode state, so you can run another bytecode with same ctx */
 static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
 {
+    unsigned i;
+
     free(ctx->opsizes);
+    ctx->opsizes = NULL;
+
     free(ctx->values);
+    ctx->values = NULL;
+
     free(ctx->operands);
     ctx->operands = NULL;
-    ctx->values = NULL;
-    ctx->opsizes = NULL;
+
     if (ctx->outfd) {
 	cli_bcapi_extract_new(ctx, -1);
 	if (ctx->outfd)
@@ -105,6 +110,10 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
 	ctx->tempfile = NULL;
 	ctx->outfd = 0;
     }
+    ctx->numParams = 0;
+    ctx->funcid = 0;
+    ctx->file_size = 0;
+    ctx->off = 0;
     ctx->written = 0;
 #if USE_MPOOL
     if (ctx->mpool) {
@@ -114,6 +123,23 @@ static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
 #else
     /*TODO: implement for no-mmap case too*/
 #endif
+    for (i=0;i<ctx->ninflates;i++)
+	cli_bcapi_inflate_done(ctx, i);
+    free(ctx->inflates);
+    ctx->inflates = NULL;
+    ctx->ninflates = 0;
+
+    for (i=0;i<ctx->nbuffers;i++)
+	cli_bcapi_buffer_pipe_done(ctx, i);
+    free(ctx->buffers);
+    ctx->buffers = NULL;
+    ctx->nbuffers = 0;
+
+    for (i=0;i<ctx->nhashsets;i++)
+	cli_bcapi_hashset_done(ctx, i);
+    free(ctx->hashsets);
+    ctx->hashsets = NULL;
+    ctx->nhashsets = 0;
     return CL_SUCCESS;
 }
 
diff --git a/libclamav/bytecode_api.c b/libclamav/bytecode_api.c
index 57b5c13..979827e 100644
--- a/libclamav/bytecode_api.c
+++ b/libclamav/bytecode_api.c
@@ -505,8 +505,11 @@ int32_t cli_bcapi_hashset_empty(struct cli_bc_ctx *ctx, int32_t id)
 
 int32_t cli_bcapi_hashset_done(struct cli_bc_ctx *ctx , int32_t id)
 {
-    /* TODO */
-    return -1;
+    struct cli_hashset *s = get_hashset(ctx, id);
+    if (!s)
+	return -1;
+    cli_hashset_destroy(s);
+    return 0;
 }
 
 int32_t cli_bcapi_buffer_pipe_new(struct cli_bc_ctx *ctx, uint32_t size)
@@ -650,8 +653,12 @@ int32_t cli_bcapi_buffer_pipe_write_stopped(struct cli_bc_ctx *ctx , int32_t id,
 
 int32_t cli_bcapi_buffer_pipe_done(struct cli_bc_ctx *ctx , int32_t id)
 {
-    /* TODO */
-    return -1;
+    struct bc_buffer *b = get_buffer(ctx, id);
+    if (!b)
+	return -1;
+    free(b->data);
+    b->data = NULL;
+    return -0;
 }
 
 int32_t cli_bcapi_inflate_init(struct cli_bc_ctx *ctx, int32_t from, int32_t to, int32_t windowBits)
diff --git a/unit_tests/check_bytecode.c b/unit_tests/check_bytecode.c
index c350fc7..425649b 100644
--- a/unit_tests/check_bytecode.c
+++ b/unit_tests/check_bytecode.c
@@ -219,6 +219,15 @@ START_TEST (test_bswap)
 }
 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);
+}
+END_TEST
+
 Suite *test_bytecode_suite(void)
 {
     Suite *s = suite_create("bytecode");
@@ -235,5 +244,6 @@ Suite *test_bytecode_suite(void)
     tcase_add_test(tc_cli_arith, test_matchwithread);
     tcase_add_test(tc_cli_arith, test_pdf);
     tcase_add_test(tc_cli_arith, test_bswap);
+    tcase_add_test(tc_cli_arith, test_inflate);
     return s;
 }
diff --git a/unit_tests/input/inflate.cbc b/unit_tests/input/inflate.cbc
new file mode 100644
index 0000000..eaeda59
--- /dev/null
+++ b/unit_tests/input/inflate.cbc
@@ -0,0 +1,21 @@
+ClamBCafhdjibjjkd|afefdfggifnf```````|bhacflfafmfbfcfmb`cnbac`cmbacdcmbgfffdfbcafbfafbc``bbaaap`clamcoincidencejb:485
+
+Tedebaeeb`eebadaaa`aabb`bb`baacbadb`bb`baacb`bb`bb`baacb`bbadb`baadb`bb`bb`bb`baadb`bbadbadb`baae`badbadb`bb`bdafahdblaah
+Ebibajbnabid|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``afbld|b`adfefbfeggfoe`gbgifnfdgoecgdgbg``bgbbmd|amifnffflfafdgefoeifnfifdg``
+G`ae`@`baeBoaBkhAhAhB`jBjaBejBkd at AcBffBofBof@BkbBidBmbBnbAa at AlBngBogBhmAd@@@`b`eBdgBefBcgBdgBkc@`bad at Aa`bad at Ab`
+A`b`bLbgab`bab`b`b`b`aa`aa`aa```b`b`bad```b`b`b`b`aa```b`b`b`b`bad`b`b`b`b`aa```b`b`b`b`Fbkaae
+Bb`baaababnaD```adb`babababnaD```adaaacnab`baa at daaadnab`bab at daaael`adac``bbEamjnmd`Taaaeadaa
+Bb`bagababcbaabadahabbbdbaaag``ibahAc`Bladb`bajabbbebaaBladb`bakabcbgbaaabBoadaaalnab`bak at d``bbEbmjnmd`Taaaladab
+Bb`banababhbakb`baoabab`babbadb`aabbbababaob`bbaaabbafb`a at db`bbbakbb`aAd`Aedaabcaeab`bbba at d``bbEcmjnmd`Taabcaacad
+Bb`bbeaababibakTcab`bDonnkd
+Bb`bbfabb`bfaTcab`bbfaE
+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
+`chgfcfflb`b`chg`c`clb`b`chgbcbflb`b`chgdciclb`b`chgbcdflb`b`chgbceflb`b`chg`caclb`b`chg`c`clb`b`chg`ccflb`b`chggceflb`b`chggcfflb`b`chgdfhclbS`chg`cdclb`b`chg`c`clb`b`chg`c`clb`b`chg`c`c`bmgkc
+ifnfdg`befnfdgbgig`gofifnfdghbibSkgSegifnfdgccbcoedg`baffgafiflfkcSegifnfdghcoedg`bjbifnf`gegdgoebflb`bjbofegdgoebfkcSifnfdgccbcoedg`bifnf`gegdgoebfegff`bmc`bbfegffffefbgoe`gif`gefoenfefgghbdc`cicfcibkc
+ifnfdgccbcoedg`bofegdg`gegdgoebfegff`bmc`bbfegffffefbgoe`gif`gefoenfefgghbdc`cicfcibkcSifff`bhbifnf`gegdgoebfegff`blc`b`c`blglg`bofegdg`gegdgoebfegff`blc`b`cibSbgefdgegbgnf`b`chgdfefafdfackc
+affgafiflf`bmc`bbfegffffefbgoe`gif`gefoeggbgifdgefoeaffgafiflfhbifnf`gegdgoebfegffibkcSifnf`gegdgoebf`bmc`bbfegffffefbgoe`gif`gefoeggbgifdgefoegfefdghbifnf`gegdgoebfegfflb`baffgafiflfibkc
+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
+dfefbfeggfhbofegdgoebfibkcSifff`bhbmfefmfcfmf`ghbofegdgoebflb`bbbdgefcgdgkcbblb`becibibSbgefdgegbgnf`b`chgdfefafdfcckcSifnffflfafdgefoedfofnfefhbifdfibkcSbgefdgegbgnf`b`chgbfefefffkc
+mgSS
\ No newline at end of file

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list