mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 17:20:30 +02:00
* fixed inserting something in a shortstring past its maximum length
(mantis #23744) git-svn-id: trunk@23524 -
This commit is contained in:
parent
2ed4b295fe
commit
a8a1bb6449
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13155,6 +13155,7 @@ tests/webtbs/tw23486.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw23503.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2351.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2363.pp svneol=native#text/plain
|
||||
tests/webtbs/tw23744.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2377.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2378.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2382.pp svneol=native#text/plain
|
||||
|
@ -74,7 +74,11 @@ begin
|
||||
if index<1 then
|
||||
index:=1;
|
||||
if index>length(s) then
|
||||
index:=length(s)+1;
|
||||
begin
|
||||
index:=length(s)+1;
|
||||
if index>high(s) then
|
||||
exit;
|
||||
end;
|
||||
indexlen:=Length(s)-Index+1;
|
||||
srclen:=length(Source);
|
||||
if sizeInt(length(source))+sizeint(length(s))>=sizeof(s) then
|
||||
@ -104,7 +108,11 @@ begin
|
||||
if index<1 then
|
||||
index:=1;
|
||||
if index>length(s) then
|
||||
index:=length(s)+1;
|
||||
begin
|
||||
index:=length(s)+1;
|
||||
if index>high(s) then
|
||||
exit;
|
||||
end;
|
||||
indexlen:=Length(s)-Index+1;
|
||||
if (sizeint(length(s))+1=sizeof(s)) and (indexlen>0) then
|
||||
dec(indexlen);
|
||||
|
15
tests/webtbs/tw23744.pp
Normal file
15
tests/webtbs/tw23744.pp
Normal file
@ -0,0 +1,15 @@
|
||||
var
|
||||
S:String[16];
|
||||
C:Char = '?';
|
||||
inss: string = 'abc';
|
||||
begin
|
||||
S:='DefineTestString';
|
||||
Insert(C,S,20);
|
||||
if (length(s)>16) or
|
||||
(s<>'DefineTestString') then
|
||||
halt(1);
|
||||
insert(inss,s,20);
|
||||
if (length(s)>16) or
|
||||
(s<>'DefineTestString') then
|
||||
halt(2);
|
||||
end.
|
Loading…
Reference in New Issue
Block a user