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

@@ -195,8 +195,10 @@ namespace DiscImageChef.Filesystems
if(sbSector + partition.Start + sectorsToRead >= partition.End) return false;
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead);
int bootChk = 0;
byte[] bootSector = imagePlugin.ReadSectors(sbSector + partition.Start, sectorsToRead);
int bootChk = 0;
if(bootSector.Length < 512) return false;
for(int i = 0; i < 0x1FF; i++) bootChk = (bootChk & 0xFF) + (bootChk >> 8) + bootSector[i];
DicConsole.DebugWriteLine("ADFS Plugin", "bootChk = {0}", bootChk);