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

@@ -181,6 +181,8 @@ namespace DiscImageChef.Filesystems
byte[] sbSector = imagePlugin.ReadSectors(sbSectorOff + partition.Start, sbSizeInSectors);
byte[] sb = new byte[sbSizeInBytes];
if(sbOff + sbSizeInBytes > sbSector.Length) return false;
Array.Copy(sbSector, sbOff, sb, 0, sbSizeInBytes);
ushort magic = BitConverter.ToUInt16(sb, 0x038);