Browse code

improve handling of zip archives

git-svn: trunk@1761

Tomasz Kojm authored on 2005/11/17 02:54:53
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Wed Nov 16 18:47:31 CET 2005 (tk)
2
+---------------------------------
3
+  * libclamav/zziplib: improve handling of incorrectly created/handcrafted zip
4
+		       archives. Test file provided by Christoph Cordes
5
+
1 6
 Tue Nov 15 21:55:25 CET 2005 (tk)
2 7
 ---------------------------------
3 8
   * libclamav/zziplib: improve handling of multi-part/broken zip archives
... ...
@@ -429,6 +429,13 @@ __zzip_parse_root_directory(int fd,
429 429
                 return ZZIP_DIR_READ;
430 430
         }
431 431
         hdr->d_compr = (uint8_t)ZZIP_GET16(d->z_compr);
432
+
433
+	if(!hdr->d_compr && hdr->d_csize != hdr->d_usize) {
434
+	    cli_dbgmsg("Zziplib: File claims to be stored but csize != usize\n");
435
+	    cli_dbgmsg("Zziplib: Switching to the inflate method\n");
436
+	    hdr->d_compr = 8;
437
+	}
438
+
432 439
 	hdr->d_flags = u_flags;
433 440
 
434 441
         /* bull: hdr->d_compr is uint8_t