allow truncated bin2 files

This commit is contained in:
Denis Molony 2022-08-10 21:01:21 +10:00
parent 82381a6a47
commit b98ecbed8d

View File

@ -43,10 +43,14 @@ public class Binary2
do do
{ {
binary2Header = new Binary2Header (buffer, ptr); binary2Header = new Binary2Header (buffer, ptr);
headers.add (binary2Header);
totalBlocks += binary2Header.totalBlocks; totalBlocks += binary2Header.totalBlocks;
ptr += ((binary2Header.eof - 1) / 128 + 2) * 128; 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); } while (binary2Header.filesToFollow > 0);
} }