mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 14:19:28 +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
|
||||
if tconstsym(srsym).consttyp=constord then
|
||||
Begin
|
||||
l:=tconstsym(srsym).value.valueord.svalue;
|
||||
l:=aint(tconstsym(srsym).value.valueord.svalue);
|
||||
SearchIConstant:=TRUE;
|
||||
exit;
|
||||
end;
|
||||
|
@ -3420,8 +3420,10 @@ implementation
|
||||
|
||||
constructor tarraydef.create_from_pointer(def:tpointerdef);
|
||||
begin
|
||||
{ use -1 so that the elecount will not overflow }
|
||||
self.create(0,high(asizeint)-1,ptrsinttype);
|
||||
{ divide by the element size and do -1 so the array will have a valid size,
|
||||
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];
|
||||
setelementdef(def.pointeddef);
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user