Date: Thu, 23 Dec 1999 12:00:02 -0800 (PST) From: Steve Price <sprice@hiwaay.net> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/15639: msdosfs can't read large (3.8gig) files (fwd) Message-ID: <199912232000.MAA13903@freefall.freebsd.org>
index | next in thread | raw e-mail
The following reply was made to PR kern/15639; it has been noted by GNATS.
From: Steve Price <sprice@hiwaay.net>
To: freebsd-gnats-submit@freebsd.org
Cc:
Subject: Re: kern/15639: msdosfs can't read large (3.8gig) files (fwd)
Date: Thu, 23 Dec 1999 13:50:29 -0600 (CST)
---------- Forwarded message ----------
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
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
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199912232000.MAA13903>
