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

@@ -69,6 +69,9 @@ namespace DiscImageChef.Filesystems
byte[] tmp = imagePlugin.ReadSectors(sector + partition.Start, run);
byte[] sbSector = new byte[AFS_SUPERBLOCK_SIZE];
if(offset + AFS_SUPERBLOCK_SIZE > tmp.Length) return false;
Array.Copy(tmp, offset, sbSector, 0, AFS_SUPERBLOCK_SIZE);
uint magic = BitConverter.ToUInt32(sbSector, 0x20);