* fixed buffer overflow in delete() for widestrings (patch by

Martin Schreiber, #10800)

git-svn-id: trunk@10255 -
This commit is contained in:
Jonas Maebe 2008-02-09 11:47:14 +00:00
parent 71a017aca0
commit 4d9445749c
3 changed files with 15 additions and 1 deletions

1
.gitattributes vendored
View File

@ -7966,6 +7966,7 @@ tests/webtbs/tw10753.pp svneol=native#text/plain
tests/webtbs/tw10753a.pp svneol=native#text/plain
tests/webtbs/tw10757.pp svneol=native#text/plain
tests/webtbs/tw10790.pp svneol=native#text/plain
tests/webtbs/tw10800.pp svneol=native#text/plain
tests/webtbs/tw1081.pp svneol=native#text/plain
tests/webtbs/tw1090.pp svneol=native#text/plain
tests/webtbs/tw1092.pp svneol=native#text/plain

View File

@ -1362,7 +1362,7 @@ begin
if Index+Size<=LS then
begin
Dec(Index);
Move(PWideChar(S)[Index+Size],PWideChar(S)[Index],(LS-Index+1)*sizeof(WideChar));
Move(PWideChar(S)[Index+Size],PWideChar(S)[Index],(LS-Index-Size+1)*sizeof(WideChar));
end;
Setlength(s,LS-Size);
end;

13
tests/webtbs/tw10800.pp Normal file
View File

@ -0,0 +1,13 @@
program widestringdelete;
{$ifdef FPC}{$mode objfpc}{$h+}{$INTERFACES CORBA}{$endif}
{$ifdef mswindows}{$apptype console}{$endif}
uses
{$ifdef FPC}{$ifdef unix}cthreads,{$endif}{$endif}
sysutils;
var
wstr1: widestring;
begin
setlength(wstr1,10240);
delete(wstr1,1,10230);
end.