[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b

aCaB acab at clamav.net
Sun Apr 4 00:59:29 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit f1f0418e6db13d65f946f71988d2671fd81b2c36
Author: aCaB <acab at clamav.net>
Date:   Wed Aug 5 22:11:47 2009 +0200

    partial fix upx/lzma

diff --git a/libclamav/lzma_iface.c b/libclamav/lzma_iface.c
index 21f7180..d7ccbca 100644
--- a/libclamav/lzma_iface.c
+++ b/libclamav/lzma_iface.c
@@ -125,32 +125,14 @@ int cli_LzmaDecode(struct CLI_LZMA *L) {
     return LZMA_RESULT_OK;
 }
 
-/* int cli_LzmaInitUPX(CLI_LZMA **Lp, uint32_t dictsz) { */
-/*   CLI_LZMA *L = *Lp; */
 
-/*   if(!L) { */
-/*     *Lp = L = cli_calloc(sizeof(*L), 1); */
-/*     if(!L) { */
-/*       return LZMA_RESULT_DATA_ERROR; */
-/*     } */
-/*   } */
-
-/*   L->state.Properties.pb = 2; /\* FIXME: these  *\/ */
-/*   L->state.Properties.lp = 0; /\* values may    *\/ */
-/*   L->state.Properties.lc = 3; /\* not be static *\/ */
-
-/*   L->state.Properties.DictionarySize = dictsz; */
-
-/*   if (!(L->state.Probs = (CProb *)cli_malloc(LzmaGetNumProbs(&L->state.Properties) * sizeof(CProb)))) */
-/*     return LZMA_RESULT_DATA_ERROR; */
-
-/*   if (!(L->state.Dictionary = (unsigned char *)cli_malloc(L->state.Properties.DictionarySize))) { */
-/*     free(L->state.Probs); */
-/*     return LZMA_RESULT_DATA_ERROR; */
-/*   } */
-
-/*   L->initted = 1; */
-
-/*   LzmaDecoderInit(&L->state); */
-/*   return LZMA_RESULT_OK; */
-/* } */
+int cli_LzmaInitUPX(struct CLI_LZMA *L, uint32_t dsz) {
+    unsigned char fake_hdr[5];
+    unsigned char *next_in = L->next_in;
+    SizeT avail_in = L->avail_in;
+    cli_writeint32(fake_hdr + 1, dsz);
+    *fake_hdr = 9 /* lc */ + 9* ( 5* 2 /* pb */ + 0 /* lp */);
+    L->next_in = fake_hdr;
+    L->avail_in = 5;
+    return cli_LzmaInit(L, dsz);
+}
diff --git a/libclamav/lzma_iface.h b/libclamav/lzma_iface.h
index b5d68e0..9784329 100644
--- a/libclamav/lzma_iface.h
+++ b/libclamav/lzma_iface.h
@@ -52,7 +52,7 @@ struct stream_state {
 int cli_LzmaInit(struct CLI_LZMA *, uint64_t);
 void cli_LzmaShutdown(struct CLI_LZMA *);
 int cli_LzmaDecode(struct CLI_LZMA *);
-/* int cli_LzmaInitUPX(struct CLI_LZMA **, uint32_t); FIXMELZMA */
+int cli_LzmaInitUPX(struct CLI_LZMA *, uint32_t);
 
 #define LZMA_STREAM_END 2
 #define LZMA_RESULT_OK 0
diff --git a/libclamav/upx.c b/libclamav/upx.c
index d7dc814..02ea5d7 100644
--- a/libclamav/upx.c
+++ b/libclamav/upx.c
@@ -528,7 +528,7 @@ int upx_inflatelzma(char *src, uint32_t ssize, char *dst, uint32_t *dsize, uint3
   uint32_t magic[]={0xb16,0xb1e,0};
 
   memset(&l, 0, sizeof(l));
-  //cli_LzmaInitUPX(&lz, *dsize); /* FIXMELZMA: make func and check return value */
+  cli_LzmaInitUPX(&l, *dsize); /* FIXMELZMA: check return value */
   s.avail_in = ssize;
   s.avail_out = *dsize;
   s.next_in = (unsigned char*)src+2;

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list