* do not crash in case of too many $push directives, resolves #39652

This commit is contained in:
florian 2022-04-07 22:51:30 +02:00
parent 92a0640bcc
commit 54dccaaad1
2 changed files with 27 additions and 18 deletions

View File

@ -1204,8 +1204,9 @@ unit scandir;
begin
if switchesstatestackpos < 1 then
Message(scan_e_too_many_pop);
Message(scan_e_too_many_pop)
else
begin
Dec(switchesstatestackpos);
recordpendinglocalfullswitch(switchesstatestack[switchesstatestackpos].localsw);
recordpendingverbosityfullswitch(switchesstatestack[switchesstatestackpos].verbosity);
@ -1223,6 +1224,7 @@ unit scandir;
out by using $Q- after a $push PM 2012-08-29 }
// flushpendingswitchesstate;
end;
end;
procedure dir_pointermath;
begin

7
tests/webtbf/tw39652.pp Normal file
View File

@ -0,0 +1,7 @@
{ %fail }
program onepoptoomanycrash;
{$PUSH}
{$POP}
{$POP}
begin
end.