Do not add drivers of size 0 neither Apple_Free partitions as

these can expand beyond the disc on optical media.
This commit is contained in:
2017-07-20 13:12:36 +01:00
parent c41645b376
commit 290cb74540

View File

@@ -109,6 +109,9 @@ namespace DiscImageChef.PartPlugins
DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddSize = {0}", ddm.sbMap[i].ddSize, i);
DicConsole.DebugWriteLine("AppleMap Plugin", "ddm.sbMap[{1}].ddType = {0}", ddm.sbMap[i].ddType, i);
if(ddm.sbMap[i].ddSize == 0)
continue;
CommonTypes.Partition part = new CommonTypes.Partition()
{
Size = (ulong)(ddm.sbMap[i].ddSize * 512),
@@ -119,6 +122,9 @@ namespace DiscImageChef.PartPlugins
Type = "Apple_Driver"
};
if((ddm.sbMap[i].ddSize * 512) % sector_size > 0)
part.Length++;
partitions.Add(part);
sequence++;
@@ -261,7 +267,9 @@ namespace DiscImageChef.PartPlugins
// BeOS doesn't mark its partitions as valid
//if(flags.HasFlag(AppleMapFlags.Valid) &&
if(StringHandlers.CToString(entry.type) != "Apple_partition_map" && entry.sectors > 0)
if(StringHandlers.CToString(entry.type) != "Apple_partition_map" && entry.sectors > 0 &&
// Some CD and DVDs end with an Apple_Free that expands beyond the disc size...
StringHandlers.CToString(entry.type) != "Apple_Free")
{
StringBuilder sb = new StringBuilder();