From f3e33aa7aaa0e76cf10d987fc1fc5673b1534850 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 23 Jul 2017 19:57:10 +0100 Subject: [PATCH] Don't ignore Apple_Free partitions, just ignore partitions that extend past the device size. --- DiscImageChef.Partitions/AppleMap.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/DiscImageChef.Partitions/AppleMap.cs b/DiscImageChef.Partitions/AppleMap.cs index 6f9b99141..d368fa3d0 100644 --- a/DiscImageChef.Partitions/AppleMap.cs +++ b/DiscImageChef.Partitions/AppleMap.cs @@ -267,9 +267,7 @@ 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 && - // Some CD and DVDs end with an Apple_Free that expands beyond the disc size... - StringHandlers.CToString(entry.type) != "Apple_Free") + if(StringHandlers.CToString(entry.type) != "Apple_partition_map" && entry.sectors > 0) { StringBuilder sb = new StringBuilder(); @@ -311,8 +309,16 @@ namespace DiscImageChef.PartPlugins } _partition.Description = sb.ToString(); - partitions.Add(_partition); - sequence++; + // Some CD and DVDs end with an Apple_Free that expands beyond the disc size... + if(_partition.End < imagePlugin.ImageInfo.sectors) + { + partitions.Add(_partition); + sequence++; + } + else + { + DicConsole.DebugWriteLine("AppleMap Plugin", "Not adding partition because end ({0}) is outside media size ({1})", _partition.End, imagePlugin.ImageInfo.sectors); + } } } }