mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-22 01:09:27 +02:00
* 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:
parent
bd69be344c
commit
242016312f
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
12
tests/webtbs/tw17430.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user