Fix plugins crashing when sector is too small.

This commit is contained in:
2019-05-06 20:09:25 +01:00
parent 4fa7e55a65
commit ca1a226c50
7 changed files with 25 additions and 12 deletions

View File

@@ -56,11 +56,11 @@ namespace DiscImageChef.Filesystems
{
if(1 + partition.Start >= partition.End) return false;
if(imagePlugin.Info.SectorSize < 512) return false;
byte[] magicB = new byte[12];
byte[] hbSector = imagePlugin.ReadSector(1 + partition.Start);
if(hbSector.Length < 512) return false;
Array.Copy(hbSector, 0x1F0, magicB, 0, 12);
string magic = Encoding.ASCII.GetString(magicB);