Browse code

more autoit fixes

git-svn: trunk@3346

aCaB authored on 2007/10/31 07:26:24
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Tue Oct 30 22:35:47 CET 2007 (acab)
2
+-----------------------------------
3
+  * libclamav/autoit: misc fixes - big thanks to Edwin
4
+
1 5
 Tue Oct 30 19:30:54 CET 2007 (tk)
2 6
 ---------------------------------
3 7
   * libclamav: add dconf support for autoit
... ...
@@ -224,6 +224,10 @@ static int ea05(int desc, cli_ctx *ctx, char *tmpd) {
224 224
       return CL_CLEAN;
225 225
     comp = *buf;
226 226
     UNP.csize = cli_readint32((char *)buf+1) ^ 0x45aa;
227
+    if ((int32_t)UNP.csize<0) {
228
+      cli_dbgmsg("autoit: bad file size - giving up\n");
229
+      return CL_CLEAN;
230
+    }
227 231
     cli_dbgmsg("autoit: compressed size: %x\n", UNP.csize);
228 232
     cli_dbgmsg("autoit: advertised uncompressed size %x\n", cli_readint32((char *)buf+5) ^ 0x45aa);
229 233
     cli_dbgmsg("autoit: ref chksum: %x\n", cli_readint32((char *)buf+9) ^ 0xc3d2);
... ...
@@ -272,12 +276,12 @@ static int ea05(int desc, cli_ctx *ctx, char *tmpd) {
272 272
       UNP.bitmap.full = 0;
273 273
       UNP.bits_avail = 0;
274 274
       UNP.error = 0;
275
-  
275
+
276 276
       while (!UNP.error && UNP.cur_output < UNP.usize) {
277 277
 	if (getbits(&UNP, 1)) {
278 278
 	  uint32_t bb, bs, addme=0;
279 279
 	  bb = getbits(&UNP, 15);
280
-      
280
+
281 281
 	  if ((bs = getbits(&UNP, 2))==3) {
282 282
 	    addme = 3;
283 283
 	    if((bs = getbits(&UNP, 3))==7) {
... ...
@@ -326,7 +330,7 @@ static int ea05(int desc, cli_ctx *ctx, char *tmpd) {
326 326
 
327 327
     /* FIXME: TODO send to text notmalization */
328 328
 
329
-    /* FIXME: ad-interim solution. ideally we should only u2a unicode scripts */
329
+    /* FIXME: ad-interim solution. ideally we should detect text and turn it to ascii */
330 330
     UNP.usize = u2a(UNP.outputbuf, UNP.usize);
331 331
 
332 332
     snprintf(tempfile, 1023, "%s/autoit.%.3u", tmpd, files);