Browse code

DCONF support for ASPACK

git-svn: trunk@3103

Tomasz Kojm authored on 2007/06/20 00:09:20
Showing 5 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Jun 19 16:41:40 CEST 2007 (tk)
2
+----------------------------------
3
+  * libclamav: DCONF support for ASPACK
4
+
1 5
 Mon Jun 18 19:30:15 BST 2007 (njh)
2 6
 ----------------------------------
3 7
   * libclamav/pdf.c:	Remove compilation warnings on some Linux
... ...
@@ -23,6 +23,7 @@
23 23
 #include "execs.h"
24 24
 #include "others.h"
25 25
 #include "rebuildpe.h"
26
+#include "aspack.h"
26 27
 
27 28
 
28 29
 struct DICT_HELPER {
... ...
@@ -325,7 +326,7 @@ int unaspack212(uint8_t *image, unsigned int size, struct cli_exe_section *secti
325 325
   struct ASPK stream;
326 326
   uint32_t i=0, j=0;
327 327
   uint8_t *blocks = image+ep+0x57c, *wrkbuf;
328
-  uint32_t block_rva, block_size;
328
+  uint32_t block_rva = 0, block_size;
329 329
   struct cli_exe_section *outsects;
330 330
 
331 331
   if (!(wrkbuf = cli_calloc(0x1800, sizeof(uint8_t)))) {
... ...
@@ -55,16 +55,17 @@ static struct dconf_module modules[] = {
55 55
     { "PE",	    "UPX",	    PE_CONF_UPX,	    1 },
56 56
     { "PE",	    "FSG",	    PE_CONF_FSG,	    1 },
57 57
 
58
-    { "PE",	    "SUE",	    PE_CONF_SUE,	    1 }, /* exp */
58
+    { "PE",	    "SUE",	    PE_CONF_SUE,	    1 },
59 59
 
60 60
     { "PE",	    "PETITE",	    PE_CONF_PETITE,	    1 },
61 61
     { "PE",	    "PESPIN",	    PE_CONF_PESPIN,	    1 },
62 62
     { "PE",	    "YC",	    PE_CONF_YC,		    1 },
63 63
     { "PE",	    "WWPACK",	    PE_CONF_WWPACK,	    1 },
64 64
 
65
-    { "PE",	    "NSPACK",	    PE_CONF_NSPACK,	    1 }, /* exp */
66
-    { "PE",	    "MEW",	    PE_CONF_MEW,	    1 }, /* exp */
67
-    { "PE",	    "UPACK",	    PE_CONF_UPACK,	    1 }, /* exp */
65
+    { "PE",	    "NSPACK",	    PE_CONF_NSPACK,	    1 },
66
+    { "PE",	    "MEW",	    PE_CONF_MEW,	    1 },
67
+    { "PE",	    "UPACK",	    PE_CONF_UPACK,	    1 },
68
+    { "PE",	    "ASPACK",	    PE_CONF_ASPACK,	    1 },
68 69
 
69 70
     { "ELF",	    NULL,	    0x1,		    1 },
70 71
 
... ...
@@ -50,6 +50,7 @@ struct cli_dconf {
50 50
 #define PE_CONF_NSPACK	    0x1000
51 51
 #define PE_CONF_MEW	    0x2000
52 52
 #define PE_CONF_UPACK	    0x4000
53
+#define PE_CONF_ASPACK	    0x8000
53 54
 
54 55
 /* Archive flags */
55 56
 #define ARCH_CONF_RAR	    0x1
... ...
@@ -2573,8 +2573,7 @@ skip_upack_and_go_to_next_unpacker:
2573 2573
     }
2574 2574
 
2575 2575
     /* ASPACK support */
2576
-#ifdef CL_EXPERIMENTAL
2577
-    while(ep+58+0x70e < fsize && !memcmp(buff,"\x60\xe8\x03\x00\x00\x00\xe9\xeb",8)) {
2576
+    while((DCONF & PE_CONF_ASPACK) && ep+58+0x70e < fsize && !memcmp(buff,"\x60\xe8\x03\x00\x00\x00\xe9\xeb",8)) {
2578 2577
         char nbuff[6];
2579 2578
 
2580 2579
         if(lseek(desc, ep+0x3b9, SEEK_SET) == -1) break;
... ...
@@ -2646,7 +2645,6 @@ skip_upack_and_go_to_next_unpacker:
2646 2646
 
2647 2647
 	break;
2648 2648
     }
2649
-#endif /* CL_EXPERIMENTAL */
2650 2649
 
2651 2650
     /* NsPack */
2652 2651