mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 18:40:20 +02:00
* fixed crash when concatenating more than 2 ansistrings that are all empty
(mantis #25349, patch by C Western) git-svn-id: trunk@26119 -
This commit is contained in:
parent
15152a2045
commit
951727f453
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -13713,6 +13713,7 @@ tests/webtbs/tw25210.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw2525.pp svneol=native#text/plain
|
tests/webtbs/tw2525.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw25269.pp svneol=native#text/pascal
|
tests/webtbs/tw25269.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw25318.pp svneol=native#text/pascal
|
tests/webtbs/tw25318.pp svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw25349.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2536.pp svneol=native#text/plain
|
tests/webtbs/tw2536.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2540.pp svneol=native#text/plain
|
tests/webtbs/tw2540.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2561.pp svneol=native#text/plain
|
tests/webtbs/tw2561.pp svneol=native#text/plain
|
||||||
|
@ -314,13 +314,18 @@ begin
|
|||||||
{$else FPC_HAS_CPSTRING}
|
{$else FPC_HAS_CPSTRING}
|
||||||
DestCP:=StringCodePage(DestS);
|
DestCP:=StringCodePage(DestS);
|
||||||
{$endif FPC_HAS_CPSTRING}
|
{$endif FPC_HAS_CPSTRING}
|
||||||
DestCP:=TranslatePlaceholderCP(DestCP);
|
|
||||||
sameCP:=true;
|
|
||||||
lowstart:=low(sarr);
|
lowstart:=low(sarr);
|
||||||
{ skip empty strings }
|
{ skip empty strings }
|
||||||
while (lowstart<=high(sarr)) and
|
while (lowstart<=high(sarr)) and
|
||||||
(sarr[lowstart]='') do
|
(sarr[lowstart]='') do
|
||||||
inc(lowstart);
|
inc(lowstart);
|
||||||
|
if lowstart>high(sarr) then
|
||||||
|
begin
|
||||||
|
DestS:=''; { All source strings empty }
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
DestCP:=TranslatePlaceholderCP(DestCP);
|
||||||
|
sameCP:=true;
|
||||||
tmpCP:=TranslatePlaceholderCP(StringCodePage(sarr[lowstart]));
|
tmpCP:=TranslatePlaceholderCP(StringCodePage(sarr[lowstart]));
|
||||||
for i:=lowstart+1 to high(sarr) do
|
for i:=lowstart+1 to high(sarr) do
|
||||||
begin
|
begin
|
||||||
|
23
tests/webtbs/tw25349.pp
Normal file
23
tests/webtbs/tw25349.pp
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
procedure trashstack;
|
||||||
|
var
|
||||||
|
a: array[0..high(word)] of byte;
|
||||||
|
begin
|
||||||
|
fillchar(a,sizeof(a),$ff);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure test;
|
||||||
|
var
|
||||||
|
s1,s2,s3,s4: ansistring;
|
||||||
|
begin
|
||||||
|
s2:='';
|
||||||
|
s3:='';
|
||||||
|
s4:='';
|
||||||
|
s1:=s2+s3+s4;
|
||||||
|
if s1<>'' then
|
||||||
|
halt(1);
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
trashstack;
|
||||||
|
test;
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user