- Fixed: The ACS VM made no checks for object files without strings, assuming

that if it didn't have any strings, then it didn't matter what it calculated
  for the location of the string table because it would never be referenced.
  While this is true for a script all by itself, it means a crash if you have
  a map script without strings that imports a library with strings and the
  library tries to use one of its strings.


SVN r281 (trunk)
This commit is contained in:
Randy Heit 2006-08-03 03:45:58 +00:00
parent 3a552d4aa0
commit f2333b6f26
2 changed files with 21 additions and 1 deletions

View file

@ -1,3 +1,11 @@
August 2, 2006
- Fixed: The ACS VM made no checks for object files without strings, assuming
that if it didn't have any strings, then it didn't matter what it calculated
for the location of the string table because it would never be referenced.
While this is true for a script all by itself, it means a crash if you have
a map script without strings that imports a library with strings and the
library tries to use one of its strings.
August 1, 2006 August 1, 2006
- It turns out that the Visual C++ 2005 runtime calls IsDebuggerPresent, which - It turns out that the Visual C++ 2005 runtime calls IsDebuggerPresent, which
is not available under Windows 95. Since this is (or at least should be) the is not available under Windows 95. Since this is (or at least should be) the

View file

@ -758,7 +758,15 @@ FBehavior::FBehavior (int lumpnum, FileReader * fr, int len)
else else
{ {
UnencryptStrings (); UnencryptStrings ();
StringTable = FindChunk (MAKE_ID('S','T','R','L')) - Data + 8; BYTE *strings = FindChunk (MAKE_ID('S','T','R','L'));
if (strings != NULL)
{
StringTable = strings - Data + 8;
}
else
{
StringTable = 0;
}
} }
if (Format == ACS_Old) if (Format == ACS_Old)
@ -1388,6 +1396,10 @@ const char *FBehavior::StaticLookupString (DWORD index)
const char *FBehavior::LookupString (DWORD index) const const char *FBehavior::LookupString (DWORD index) const
{ {
if (StringTable == 0)
{
return NULL;
}
if (Format == ACS_Old) if (Format == ACS_Old)
{ {
DWORD *list = (DWORD *)(Data + StringTable); DWORD *list = (DWORD *)(Data + StringTable);