* immediately fail when trying to allocate a memory block whose size falls

in the range high(ptruint)-$fffe .. high(ptruint), because all large
    allocations are rounded up to the next multiple of 64kb, which is 0 in
    that case (mantis #17430)

git-svn-id: trunk@16001 -
This commit is contained in:
Jonas Maebe 2010-09-17 14:05:06 +00:00
parent bd69be344c
commit 242016312f
3 changed files with 20 additions and 0 deletions

1
.gitattributes vendored
View File

@ -10659,6 +10659,7 @@ tests/webtbs/tw17379a.pp svneol=native#text/plain
tests/webtbs/tw17402.pp svneol=native#text/pascal
tests/webtbs/tw17402a.pp svneol=native#text/pascal
tests/webtbs/tw17413.pp svneol=native#text/plain
tests/webtbs/tw17430.pp svneol=native#text/plain
tests/webtbs/tw1744.pp svneol=native#text/plain
tests/webtbs/tw1754c.pp svneol=native#text/plain
tests/webtbs/tw1755.pp svneol=native#text/plain

View File

@ -970,6 +970,13 @@ var
iter : cardinal;
begin
result:=nil;
{ check for maximum possible allocation (everything is rounded up to the
next multiple of 64k) }
if (size>high(ptruint)-$ffff) then
if ReturnNilIfGrowHeapFails then
exit
else
HandleError(204);
{ free pending items }
loc_freelists := @freelists;
try_finish_waitvarlist(loc_freelists);

12
tests/webtbs/tw17430.pp Normal file
View File

@ -0,0 +1,12 @@
program Project1;
{$mode delphi}{$H+}
var
p:pointer;
begin
returnnilifgrowheapfails:=true;
GetMem(p,ptruint(-128));
if assigned(p) then
halt(1);
end.