Make fixes from manual testing

This commit is contained in:
Matt Nadareski
2025-09-26 16:38:56 -04:00
parent 0d4dcf4a60
commit 575caeda92

View File

@@ -33,11 +33,14 @@ namespace SabreTools.Serialization.Readers
// Set the footer
sfx.Footer = footer;
// Seek to the entry table offset
// Get to the entry table offset
long tableOffset = initialOffset + footer.TablePointer;
if (tableOffset < initialOffset || tableOffset >= data.Length)
return null;
// Seek to the entry table
data.Seek(tableOffset, SeekOrigin.Begin);
// Try to parse the entry table
var table = ParseTable(data, footer.EntryCount);
if (table.Length != footer.EntryCount)
@@ -72,6 +75,9 @@ namespace SabreTools.Serialization.Readers
// Set a maximum of 10 iterations to find the signature
int iterations = 10;
// Seek backward to the first point it could be
data.Seek(-10, SeekOrigin.Current);
// Search backward for the signature
bool signatureFound = false;
do
@@ -85,6 +91,7 @@ namespace SabreTools.Serialization.Readers
}
iterations--;
data.Seek(-11, SeekOrigin.Current);
} while (iterations > 0);