mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 16:49:20 +02:00
* fixed web bug #3805
* extra range check in fpc_dynarray_copy (also error if lowidx > high(source))
This commit is contained in:
parent
bf5ac5abfa
commit
9ccf2effdc
@ -349,9 +349,11 @@ procedure fpc_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;
|
|||||||
highidx:=realpsrc^.high;
|
highidx:=realpsrc^.high;
|
||||||
end;
|
end;
|
||||||
{ get number of elements and check for invalid values }
|
{ get number of elements and check for invalid values }
|
||||||
if (lowidx<0) or (highidx<0) then
|
if (lowidx<0) or (highidx<0) or (lowidx > realpsrc^.high) then
|
||||||
HandleErrorFrame(201,get_frame);
|
HandleErrorFrame(201,get_frame);
|
||||||
cnt:=highidx-lowidx+1;
|
cnt:=highidx-lowidx+1;
|
||||||
|
if (cnt > realpsrc^.high - lowidx + 1) then
|
||||||
|
cnt := realpsrc^.high - lowidx + 1;
|
||||||
{ create new array }
|
{ create new array }
|
||||||
size:=elesize*cnt;
|
size:=elesize*cnt;
|
||||||
getmem(realpdest,size+sizeof(tdynarray));
|
getmem(realpdest,size+sizeof(tdynarray));
|
||||||
@ -372,7 +374,12 @@ procedure fpc_dynarray_copy(var pdest : pointer;psrc : pointer;ti : pointer;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.37 2005-03-05 16:37:28 florian
|
Revision 1.38 2005-03-27 14:56:34 jonas
|
||||||
|
* fixed web bug 3805
|
||||||
|
* extra range check in fpc_dynarray_copy (also error if lowidx >
|
||||||
|
high(source))
|
||||||
|
|
||||||
|
Revision 1.37 2005/03/05 16:37:28 florian
|
||||||
* fixed copy(dyn. array,...);
|
* fixed copy(dyn. array,...);
|
||||||
|
|
||||||
Revision 1.36 2005/02/14 17:13:22 peter
|
Revision 1.36 2005/02/14 17:13:22 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user