mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
Merge pull request #371 from edward-san/acs_strlen_invalid
- Fixed a crash in ACS strlen parsing with invalid argument.
This commit is contained in:
commit
90d1e85aa2
1 changed files with 16 additions and 1 deletions
|
@ -8880,7 +8880,22 @@ scriptwait:
|
|||
break;
|
||||
|
||||
case PCD_STRLEN:
|
||||
STACK(1) = SDWORD(strlen(FBehavior::StaticLookupString (STACK(1))));
|
||||
{
|
||||
const char *str = FBehavior::StaticLookupString(STACK(1));
|
||||
if (str != NULL)
|
||||
{
|
||||
STACK(1) = SDWORD(strlen(str));
|
||||
break;
|
||||
}
|
||||
|
||||
static bool StrlenInvalidPrintedAlready = false;
|
||||
if (!StrlenInvalidPrintedAlready)
|
||||
{
|
||||
Printf(PRINT_BOLD, "Warning: ACS function strlen called with invalid string argument.\n");
|
||||
StrlenInvalidPrintedAlready = true;
|
||||
}
|
||||
STACK(1) = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case PCD_GETCVAR:
|
||||
|
|
Loading…
Reference in a new issue