summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mandriva.org>2009-11-26 13:21:41 +0000
committerPascal Terjan <pterjan@mandriva.org>2009-11-26 13:21:41 +0000
commit50b375730189856bf2efa70dde83d78389d611c9 (patch)
tree2e737cd56d258c76739e1b40a415c92d01250148
parent40828f2b19138c5b0fc6f7f7e5625f20881ead69 (diff)
downloaddrakx-backup-do-not-use-50b375730189856bf2efa70dde83d78389d611c9.tar
drakx-backup-do-not-use-50b375730189856bf2efa70dde83d78389d611c9.tar.gz
drakx-backup-do-not-use-50b375730189856bf2efa70dde83d78389d611c9.tar.bz2
drakx-backup-do-not-use-50b375730189856bf2efa70dde83d78389d611c9.tar.xz
drakx-backup-do-not-use-50b375730189856bf2efa70dde83d78389d611c9.zip
detect better invalid dos partition table (fixes a crash in harddrake)
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/partition_table/dos.pm14
2 files changed, 15 insertions, 0 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index 1adb23681..1127492f2 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -11,6 +11,7 @@
o fix detecting some mice
- bootloader:
o do not add removable drives as "Windows" entry in bootloader
+- detect better invalid dos partition table (fixes a crash in harddrake)
Version 12.78 - 18 November 2009
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index 2376fce11..66157c08b 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -220,6 +220,20 @@ sub read_one {
sysread $F, $tmp, length $magic or die "error reading magic number on disk $hd->{device}";
$tmp eq $magic or die "bad magic number on disk $hd->{device}";
+ if(c::get_disk_type($hd->{file}) ne "msdos") {
+ # libparted may have ignored it because of overlapping partitions or other error
+ # while it is actually a partition table.
+ $hd->{fs_type_from_magic} and die "unpartitionned disk";
+ my $primary = partition_table::raw::pt_info_to_primary($hd, [ @pt ]);
+ foreach my $i (@{$primary->{normal}}) {
+ print Dumper($hd);
+ if (($i->{active} && $i->{active} != 0x80) ||
+ ($hd->{totalsectors} && $i->{start} > $hd->{totalsectors})) {
+ die "Invalid DOS partition table";
+ }
+ }
+ }
+
[ @pt ];
}