From 8481f73b2c6986cf86604d5857c7f47d7cfd377d Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 8 Nov 2017 17:44:39 +0000 Subject: [PATCH] On GPT, corrected reading when total entries are less than a whole sector size. --- DiscImageChef.Partitions/GPT.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DiscImageChef.Partitions/GPT.cs b/DiscImageChef.Partitions/GPT.cs index 16b90c57d..d04b17c7d 100644 --- a/DiscImageChef.Partitions/GPT.cs +++ b/DiscImageChef.Partitions/GPT.cs @@ -113,7 +113,7 @@ namespace DiscImageChef.PartPlugins if(hdr.signature != GptMagic) return false; - if(hdr.myLBA != 1) + if(hdr.myLBA != 1 + sectorOffset) return false; uint divisor, modulo, sectorSize; @@ -132,6 +132,8 @@ namespace DiscImageChef.PartPlugins } uint totalEntriesSectors = (hdr.entries * hdr.entriesSize) / imagePlugin.GetSectorSize(); + if((hdr.entries * hdr.entriesSize) % imagePlugin.GetSectorSize() > 0) + totalEntriesSectors++; byte[] temp = imagePlugin.ReadSectors(hdr.entryLBA / divisor, totalEntriesSectors + modulo); byte[] entriesBytes = new byte[temp.Length - (modulo * 512)];