mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-10 13:39:14 +02:00
LCL: TTextStrings: check Index out of bounds
git-svn-id: trunk@42186 -
This commit is contained in:
parent
08bdff7239
commit
31d427c439
@ -199,9 +199,11 @@ end;
|
|||||||
|
|
||||||
function TTextStrings.GetObject(Index: Integer): TObject;
|
function TTextStrings.GetObject(Index: Integer): TObject;
|
||||||
begin
|
begin
|
||||||
if FArraysValid then
|
if FArraysValid then begin
|
||||||
Result:=FLineRanges[Index].TheObject
|
if (Index<0) or (Index>=FLineCount) then
|
||||||
else
|
Error(rsListIndexExceedsBounds, Index);
|
||||||
|
Result:=FLineRanges[Index].TheObject;
|
||||||
|
end else
|
||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -217,6 +219,8 @@ var
|
|||||||
NewEndPos: Integer;
|
NewEndPos: Integer;
|
||||||
begin
|
begin
|
||||||
if not FArraysValid then BuildArrays;
|
if not FArraysValid then BuildArrays;
|
||||||
|
if (Index<0) or (Index>=FLineCount) then
|
||||||
|
Error(rsListIndexExceedsBounds, Index);
|
||||||
OldStartPos:=FLineRanges[Index].StartPos;
|
OldStartPos:=FLineRanges[Index].StartPos;
|
||||||
OldEndPos:=FLineRanges[Index].EndPos;
|
OldEndPos:=FLineRanges[Index].EndPos;
|
||||||
NewLineLen:=length(s);
|
NewLineLen:=length(s);
|
||||||
@ -256,6 +260,8 @@ end;
|
|||||||
procedure TTextStrings.PutObject(Index: Integer; AnObject: TObject);
|
procedure TTextStrings.PutObject(Index: Integer; AnObject: TObject);
|
||||||
begin
|
begin
|
||||||
if not FArraysValid then BuildArrays;
|
if not FArraysValid then BuildArrays;
|
||||||
|
if (Index<0) or (Index>=FLineCount) then
|
||||||
|
Error(rsListIndexExceedsBounds, Index);
|
||||||
FLineRanges[Index].TheObject:=AnObject;
|
FLineRanges[Index].TheObject:=AnObject;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -399,6 +405,8 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
if not FArraysValid then BuildArrays;
|
if not FArraysValid then BuildArrays;
|
||||||
|
if (Index<0) or (Index>=FLineCount) then
|
||||||
|
Error(rsListIndexExceedsBounds, Index);
|
||||||
// adjust text
|
// adjust text
|
||||||
OldLineLen:=GetLineLen(Index,true);
|
OldLineLen:=GetLineLen(Index,true);
|
||||||
if OldLineLen>0 then begin
|
if OldLineLen>0 then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user