mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 16:39:16 +02:00
* fixed memory corruption in trgobj.add_to_movelist on 64 bit platforms
git-svn-id: trunk@9523 -
This commit is contained in:
parent
58600c71b9
commit
8d9bfcaa7d
@ -661,7 +661,8 @@ unit rgobj;
|
|||||||
begin
|
begin
|
||||||
if movelist=nil then
|
if movelist=nil then
|
||||||
begin
|
begin
|
||||||
getmem(movelist,sizeof(tmovelistheader)+60*sizeof(pointer));
|
{ don't use sizeof(tmovelistheader), because that ignores alignment }
|
||||||
|
getmem(movelist,ptrint(@movelist^.data)-ptrint(movelist)+60*sizeof(pointer));
|
||||||
movelist^.header.maxcount:=60;
|
movelist^.header.maxcount:=60;
|
||||||
movelist^.header.count:=0;
|
movelist^.header.count:=0;
|
||||||
movelist^.header.sorted_until:=0;
|
movelist^.header.sorted_until:=0;
|
||||||
@ -671,7 +672,8 @@ unit rgobj;
|
|||||||
if movelist^.header.count>=movelist^.header.maxcount then
|
if movelist^.header.count>=movelist^.header.maxcount then
|
||||||
begin
|
begin
|
||||||
movelist^.header.maxcount:=movelist^.header.maxcount*2;
|
movelist^.header.maxcount:=movelist^.header.maxcount*2;
|
||||||
reallocmem(movelist,sizeof(tmovelistheader)+movelist^.header.maxcount*sizeof(pointer));
|
{ don't use sizeof(tmovelistheader), because that ignores alignment }
|
||||||
|
reallocmem(movelist,ptrint(@movelist^.data)-ptrint(movelist)+movelist^.header.maxcount*sizeof(pointer));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
movelist^.data[movelist^.header.count]:=data;
|
movelist^.data[movelist^.header.count]:=data;
|
||||||
|
Loading…
Reference in New Issue
Block a user