bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] SIGFPE when fat cluster size is 0


From: Andrew Clausen
Subject: Re: [PATCH] SIGFPE when fat cluster size is 0
Date: Mon, 11 Nov 2002 11:16:26 +1100
User-agent: Mutt/1.4i

On Sun, Nov 10, 2002 at 07:05:47PM -0500, Matthew Wilson wrote:
> Yea or nay?

Crazy!  I never got (or noticed?) this email.  Sorry!

> On Thu, Nov 07, 2002 at 04:40:22PM -0500, Matt Wilson wrote:
> > This patch corrects a divide by zero in bootsector.c:97 if
> > cluster_size is 0.  Basically fat_probe() would do
> > fat_boot_sector_analyse(), which would return 0.  Then it would try to
> > figure out the fat type, which calls fat_boot_sector_probe_type().
> > This would SIGFPE.  The call to fat_boot_sector_probe_type() was
> > overkill anyway since it's already called in fat_boot_sector_analyse()
> > anyway to set fs_info->fat_type.

Hmmmm.

The problem is: if there's some kind [eg: non-fatal] of a problem with
the boot-sector (eg: more sectors for the FATs than expected), then
fat_boot_sector_analyse() will raise an exception.  Since probe is
usually invoked under ped_exception_fetch_all(), the default handler
might choose "cancel", and the file system might not get detected
at all.

So, fat_boot_sector_probe_type() should work independently, and be
able to guess pretty well what the type is, without needing to guess
how big the file system is.

So, the Right Solution is to check for 0's before division.  And
a few more comments explaining the situation ;)

Thanks,
Andrew





reply via email to

[Prev in Thread] Current Thread [Next in Thread]