Subject: kern/34589: vnd(4) compress error with large files
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Cliff Wright <cliff@vixen.snipe444.org>
List: netbsd-bugs
Date: 09/23/2006 00:35:00
>Number:         34589
>Category:       kern
>Synopsis:       vnd(4) compress error with large files
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 23 00:35:00 +0000 2006
>Originator:     Cliff Wright
>Release:        NetBSD 3.0.1
>Organization:
	
>Environment:
	
	
>Description:
	
	When a very large compressed file system image is used (16GB to
	6GB for my test case), disklabel file size is wrong.
	Two 32 bit numbers were multiplied, and then assigned to
	a 64 bit number, the 32 bit numbers needed to be cast to 64 first.
	Below is the patch to fix this.

>How-To-Repeat:
	
>Fix:
	
--- vnd.c.orig	2005-10-07 04:47:40.000000000 -0700
+++ vnd.c	2006-09-22 17:13:54.000000000 -0700
@@ -934,7 +934,8 @@
  
                         /* set decompressed file size */
                         vattr.va_size =
-                          (vnd->sc_comp_numoffs - 1) * vnd->sc_comp_blksz;
+                          ((u_int64_t)vnd->sc_comp_numoffs - 1) *
+                           (u_int64_t)vnd->sc_comp_blksz;
  
                         /* allocate space for all the compressed offsets */
                         vnd->sc_comp_offsets =

>Unformatted: