Add more checks for partitions that end, or start, after end

of device.
This commit is contained in:
2017-08-07 16:09:46 +01:00
parent fa6bacdedd
commit 5ce40b68d0

View File

@@ -311,15 +311,22 @@ namespace DiscImageChef.PartPlugins
} }
_partition.Description = sb.ToString(); _partition.Description = sb.ToString();
// Some CD and DVDs end with an Apple_Free that expands beyond the disc size... if(_partition.Start < imagePlugin.ImageInfo.sectors && _partition.End < imagePlugin.ImageInfo.sectors)
if(_partition.End < imagePlugin.ImageInfo.sectors)
{ {
partitions.Add(_partition); partitions.Add(_partition);
sequence++; sequence++;
} }
// Some CD and DVDs end with an Apple_Free that expands beyond the disc size...
else if(_partition.Start < imagePlugin.ImageInfo.sectors)
{
DicConsole.DebugWriteLine("AppleMap Plugin", "Cutting last partition end ({0}) to media size ({1})", _partition.End, imagePlugin.ImageInfo.sectors - 1);
_partition.Length = imagePlugin.ImageInfo.sectors - _partition.Start;
partitions.Add(_partition);
sequence++;
}
else else
{ {
DicConsole.DebugWriteLine("AppleMap Plugin", "Not adding partition because end ({0}) is outside media size ({1})", _partition.End, imagePlugin.ImageInfo.sectors); DicConsole.DebugWriteLine("AppleMap Plugin", "Not adding partition becaus start ({0}) is outside media size ({1})", _partition.Start, imagePlugin.ImageInfo.sectors - 1);
} }
} }
} }