Date: Thu, 23 Dec 1999 11:40:40 -0800 From: Tim Kientzle <kientzle@acm.org> To: gnats-admin@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: kern/15639: msdosfs can't read large (3.8gig) files Message-ID: <38627AB8.AD0E4D37@acm.org> References: <199912230540.VAA80061@freefall.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
gnats-admin@FreeBSD.org wrote: > > Thank you very much for your problem report. > It has the internal identification `kern/15639'. > The individual assigned to look at your > report is: freebsd-bugs. > > >Category: kern > >Responsible: freebsd-bugs > >Synopsis: msdosfs can't read large (3.8gig) files > >Arrival-Date: Wed Dec 22 21:40:00 PST 1999 I've since found a fix for this problem. The bug is in 'msdosfs_vnops.c', in the function 'msdosfs_read'. Early in that function, it computes fileSize minus requestedOffset, and stores the difference into a signed int. With very large files, that int can overflow. A better approach is to make 'diff' an unsigned long, use a direct comparison for the initial test, and then be cautious about comparing 'diff' to the signed 'n': if (dep->de_FileSize <= uio->uio_offset) return (0); /* Note: diff can be as large as 4gig! */ diff = dep->de_FileSize - uio->uio_offset; /* Avoid setting n to a negative value */ if ((diff < n) && (diff < LONG_MAX)) n = diff; This change allowed me to successfully copy a 3.8gig file from an MSDOS-formatted hard disk. - Tim Kientzle To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?38627AB8.AD0E4D37>