allow truncated bin2 files

This commit is contained in:
Denis Molony 2022-08-10 21:01:21 +10:00
parent 82381a6a47
commit b98ecbed8d
1 changed files with 5 additions and 1 deletions

View File

@ -43,10 +43,14 @@ public class Binary2
do
{
binary2Header = new Binary2Header (buffer, ptr);
headers.add (binary2Header);
totalBlocks += binary2Header.totalBlocks;
ptr += ((binary2Header.eof - 1) / 128 + 2) * 128;
if (ptr > buffer.length) // not enough blocks for this file
break;
headers.add (binary2Header);
} while (binary2Header.filesToFollow > 0);
}