mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-11 21:46:00 +02:00
* fixed copy where size+index could be < 0
This commit is contained in:
parent
a352b586ca
commit
4c3df986f0
@ -455,8 +455,10 @@ var
|
||||
begin
|
||||
ResultAddress:=Nil;
|
||||
dec(index);
|
||||
{ Check Size. Accounts for Zero-length S }
|
||||
if Length(S)<Index+Size then
|
||||
{ Check Size. Accounts for Zero-length S, the double check is needed because
|
||||
Size can be maxint and will get <0 when adding index }
|
||||
if (Size>Length(S)) or
|
||||
(Index+Size>Length(S)) then
|
||||
Size:=Length(S)-Index;
|
||||
If Size>0 then
|
||||
begin
|
||||
@ -502,7 +504,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
pos := j;
|
||||
end;
|
||||
|
||||
@ -623,16 +624,19 @@ begin
|
||||
S:=Temp;
|
||||
end;
|
||||
|
||||
Function StringOfChar(c : char;l : longint) : AnsiString;
|
||||
|
||||
begin
|
||||
SetLength(StringOfChar,l);
|
||||
FillChar(Pointer(StringOfChar)^,Length(StringOfChar),c);
|
||||
end;
|
||||
Function StringOfChar(c : char;l : longint) : AnsiString;
|
||||
begin
|
||||
SetLength(StringOfChar,l);
|
||||
FillChar(Pointer(StringOfChar)^,Length(StringOfChar),c);
|
||||
end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.33 1999-10-27 14:27:49 florian
|
||||
Revision 1.34 1999-11-02 23:57:54 peter
|
||||
* fixed copy where size+index could be < 0
|
||||
|
||||
Revision 1.33 1999/10/27 14:27:49 florian
|
||||
* StringOfChar fixed, how can be a bug in two lines of code ?????
|
||||
|
||||
Revision 1.32 1999/10/27 14:17:20 florian
|
||||
|
Loading…
Reference in New Issue
Block a user