mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-23 23:35:09 +00:00
Stricter with COFF tables
This commit is contained in:
@@ -99,7 +99,8 @@ namespace SabreTools.Serialization.Deserializers
|
||||
executable.COFFSymbolTable = ParseCOFFSymbolTable(data, coffFileHeader.NumberOfSymbols);
|
||||
|
||||
// Set the COFF string table
|
||||
executable.COFFStringTable = ParseCOFFStringTable(data);
|
||||
if (executable.COFFSymbolTable != null)
|
||||
executable.COFFStringTable = ParseCOFFStringTable(data);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -400,7 +401,7 @@ namespace SabreTools.Serialization.Deserializers
|
||||
/// <param name="data">Stream to parse</param>
|
||||
/// <param name="count">Number of COFF symbol table entries to read</param>
|
||||
/// <returns>Filled COFF symbol table on success, null on error</returns>
|
||||
public static COFFSymbolTableEntry[] ParseCOFFSymbolTable(Stream data, uint count)
|
||||
public static COFFSymbolTableEntry[]? ParseCOFFSymbolTable(Stream data, uint count)
|
||||
{
|
||||
var coffSymbolTable = new COFFSymbolTableEntry[count];
|
||||
|
||||
@@ -468,6 +469,10 @@ namespace SabreTools.Serialization.Deserializers
|
||||
{
|
||||
currentSymbolType = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Auxiliary Format 1: Function Definitions
|
||||
@@ -543,6 +548,12 @@ namespace SabreTools.Serialization.Deserializers
|
||||
auxSymbolsRemaining--;
|
||||
}
|
||||
|
||||
// Invalid case, should never happen
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we hit the last aux symbol, go back to normal format
|
||||
if (auxSymbolsRemaining == 0)
|
||||
currentSymbolType = 0;
|
||||
|
||||
Reference in New Issue
Block a user