[Top][All Lists]
[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:29:29 +1100 |
User-agent: |
Mutt/1.4i |
Hi Matt,
Here's my solution. It works?
Cheers,
Andrew
--- /home/parted/parted-1.6.3/libparted/fs_fat/bootsector.c 2002-05-11
19:36:47.000000000 +1000
+++ bootsector.c 2002-11-11 11:26:02.000000000 +1100
@@ -1,6 +1,6 @@
/*
libparted
- Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,6 +27,13 @@
#include <fcntl.h>
#include <errno.h>
+/* Reads in the boot sector (superblock), and does a minimum of sanity
+ * checking. The goals are:
+ * - to detect fat file systems, even if they are damaged [i.e. not
+ * return an error / throw an exception]
+ * - to fail detection if there's not enough information for
+ * fat_boot_sector_probe_type() to work (or possibly crash on a divide-by-zero)
+ */
int
fat_boot_sector_read (FatBootSector* bs, const PedGeometry *geom)
{
@@ -57,6 +64,13 @@
return 0;
}
+ if (!bs->cluster_size) {
+ ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
+ _("File system has an invalid cluster size for a FAT "
+ "file system."));
+ return 0;
+ }
+
if (!bs->reserved) {
ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
_("File system has an invalid number of reserved "