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


The following commit has been merged in the debian/unstable branch:
commit c2cca657d79583651b8bbb212a7e175a3b116e3e
Author: aCaB <acab at clamav.net>
Date:   Tue Aug 25 02:01:25 2009 +0200

    fmap fix reading of the last page, ole2 port to fmap

diff --git a/libclamav/fmap.c b/libclamav/fmap.c
index 9df907c..c8149e3 100644
--- a/libclamav/fmap.c
+++ b/libclamav/fmap.c
@@ -48,8 +48,8 @@
 */
 
 /* FIXME: tune this stuff */
-#define UNPAGE_THRSHLD_HI 1*1024*1024
-#define UNPAGE_THRSHLD_LO 4*1024*1024
+#define UNPAGE_THRSHLD_LO 1*1024*1024
+#define UNPAGE_THRSHLD_HI 4*1024*1024
 
 struct F_MAP {
     int fd;
@@ -165,7 +165,7 @@ static void fmap_aging(struct F_MAP *m) {
 	    if(avail * m->pgsz > UNPAGE_THRSHLD_HI ) {
 		/* if we've got more unpageable pages than we need, we pick the oldest */
 		fmap_qsel(m, freeme, 0, avail - 1);
-		avail = UNPAGE_THRSHLD_HI % m->pgsz;
+		avail = UNPAGE_THRSHLD_HI / m->pgsz;
 	    }
 	    for(i=0; i<avail; i++) {
 		char *pptr = (char *)m + i * m->pgsz + m->hdrsz;
@@ -214,7 +214,7 @@ static int fmap_readpage(struct F_MAP *m, unsigned int page, int lock) {
 
     /* page is not already paged */
     pptr = (char *)m + page * m->pgsz + m->hdrsz;
-    if(page == m->pages - 1)
+    if((page == m->pages - 1) && (m->len % m->pgsz))
 	readsz = m->len % m->pgsz;
     else
 	readsz = m->pgsz;
diff --git a/libclamav/ole2_extract.c b/libclamav/ole2_extract.c
index 2addd4c..730aa3c 100644
--- a/libclamav/ole2_extract.c
+++ b/libclamav/ole2_extract.c
@@ -913,7 +913,7 @@ int cli_ole2_extract(int fd, const char *dirname, cli_ctx *ctx, struct uniq **vb
 		hdr.m_length = statbuf.st_size;
 		hdr.map = fmap(fd, 0, hdr.m_length);
 		if (hdr.map) {
-			void *phdr = fmap_need_off(hdr.map, 0, hdr_size);
+			void *phdr = fmap_need_off_once(hdr.map, 0, hdr_size);
 			if(phdr) {
 				cli_dbgmsg("mmap'ed file\n");
 				memcpy(&hdr, phdr, hdr_size);
@@ -936,7 +936,7 @@ int cli_ole2_extract(int fd, const char *dirname, cli_ctx *ctx, struct uniq **vb
 		}
 #endif
 	}
-	
+
 	hdr.minor_version = ole2_endian_convert_16(hdr.minor_version);
 	hdr.dll_version = ole2_endian_convert_16(hdr.dll_version);
 	hdr.byte_order = ole2_endian_convert_16(hdr.byte_order);

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list