* fixed potential buffer overflow error when creating the fullprocname for

display purposes if there was a parameter with a default value > 255 chars
  * replace #0, #10 and #13 in the fullprocname with '.' so they do not cause
    line breaks or early string termination when writing them to the
    assembler file (mantis #17928)

git-svn-id: trunk@16344 -
This commit is contained in:
Jonas Maebe 2010-11-14 12:18:48 +00:00
parent fdfb21387f
commit d36f8ac542
3 changed files with 23 additions and 2 deletions

1
.gitattributes vendored
View File

@ -10748,6 +10748,7 @@ tests/webtbs/tw17907/test.bat svneol=native#text/plain
tests/webtbs/tw17907/unit1/unit0001.pas svneol=native#text/plain
tests/webtbs/tw17907/unit2/unit0002.pas svneol=native#text/plain
tests/webtbs/tw1792.pp svneol=native#text/plain
tests/webtbs/tw17928.pp svneol=native#text/plain
tests/webtbs/tw1792a.pp svneol=native#text/plain
tests/webtbs/tw1798.pp svneol=native#text/plain
tests/webtbs/tw1820.pp svneol=native#text/plain

View File

@ -2974,8 +2974,17 @@ implementation
begin
If hpc.value.len>0 then
begin
setLength(hs,hpc.value.len);
move(hpc.value.valueptr^,hs[1],hpc.value.len);
setLength(hs,hpc.value.len);
{ don't write past the end of hs if the constant
is > 255 chars }
move(hpc.value.valueptr^,hs[1],length(hs));
{ make sure that constant strings with newline chars
don't create a linebreak in the assembler code,
since comments are line-based. Also remove nulls
because the comments are written as a pchar. }
ReplaceCase(hs,#0,'.');
ReplaceCase(hs,#10,'.');
ReplaceCase(hs,#13,'.');
end;
end;
constreal :

11
tests/webtbs/tw17928.pp Normal file
View File

@ -0,0 +1,11 @@
{ %norun }
{ %opt=-a }
{$mode delphi}
procedure AddItemsFromString(const aItems: String; const aSeparator: String = #13#10);
begin
end;
begin
end.