mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 16:39:19 +02:00
* fix possible range check errors, resolves #27461
git-svn-id: trunk@29743 -
This commit is contained in:
parent
0dfbba86f3
commit
726a78be08
@ -1205,7 +1205,7 @@ Begin
|
|||||||
begin
|
begin
|
||||||
if tconstsym(srsym).consttyp=constord then
|
if tconstsym(srsym).consttyp=constord then
|
||||||
Begin
|
Begin
|
||||||
l:=tconstsym(srsym).value.valueord.svalue;
|
l:=aint(tconstsym(srsym).value.valueord.svalue);
|
||||||
SearchIConstant:=TRUE;
|
SearchIConstant:=TRUE;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
@ -3420,8 +3420,10 @@ implementation
|
|||||||
|
|
||||||
constructor tarraydef.create_from_pointer(def:tpointerdef);
|
constructor tarraydef.create_from_pointer(def:tpointerdef);
|
||||||
begin
|
begin
|
||||||
{ use -1 so that the elecount will not overflow }
|
{ divide by the element size and do -1 so the array will have a valid size,
|
||||||
self.create(0,high(asizeint)-1,ptrsinttype);
|
further, the element size might be 0 e.g. for empty records, so use max(...,1)
|
||||||
|
to avoid a division by zero }
|
||||||
|
self.create(0,(high(asizeint) div max(def.pointeddef.size,1))-1,ptrsinttype);
|
||||||
arrayoptions:=[ado_IsConvertedPointer];
|
arrayoptions:=[ado_IsConvertedPointer];
|
||||||
setelementdef(def.pointeddef);
|
setelementdef(def.pointeddef);
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user