+ give an error if allocated temps. overflow the normally max. available space

git-svn-id: trunk@30449 -
This commit is contained in:
florian 2015-04-05 20:59:34 +00:00
parent 444b63cf07
commit b684719f1e
3 changed files with 16 additions and 0 deletions

1
.gitattributes vendored
View File

@ -9839,6 +9839,7 @@ tests/tbf/tb0247.pp svneol=native#text/pascal
tests/tbf/tb0248.pp svneol=native#text/pascal
tests/tbf/tb0249.pp svneol=native#text/pascal
tests/tbf/tb0250.pp svneol=native#text/pascal
tests/tbf/tb0251.pp svneol=native#text/pascal
tests/tbf/ub0115.pp svneol=native#text/plain
tests/tbf/ub0149.pp svneol=native#text/plain
tests/tbf/ub0158a.pp svneol=native#text/plain

View File

@ -413,12 +413,16 @@ implementation
{ Extend the temp }
if direction=-1 then
begin
if qword(align(-lasttemp-alignmismatch,alignment))+size+alignmismatch>high(tl^.pos) then
CGMessage(cg_e_localsize_too_big);
lasttemp:=(-align(-lasttemp-alignmismatch,alignment))-size-alignmismatch;
tl^.pos:=lasttemp;
end
else
begin
tl^.pos:=align(lasttemp+alignmismatch,alignment)-alignmismatch;
if qword(tl^.pos)+size>high(tl^.pos) then
CGMessage(cg_e_localsize_too_big);
lasttemp:=tl^.pos+size;
end;

11
tests/tbf/tb0251.pp Normal file
View File

@ -0,0 +1,11 @@
{ %fail }
procedure p;
var
{ generate big local data structures which overflow the stack for sure }
a1,a2,a3,a4,a5 : array[0..high(sizeint) div 4] of byte;
begin
end;
begin
end.