* some potential rangecheck errors fixed, Mantis #22933, suggested fixes

by Anton

git-svn-id: trunk@22499 -
This commit is contained in:
marco 2012-09-28 20:04:00 +00:00
parent 37ed624706
commit 5866e2435c
2 changed files with 3 additions and 2 deletions

View File

@ -821,7 +821,8 @@ begin
if CopyLastWordCharCount > 0 then
Result := Copy(ALastWord, 1, CopyLastWordCharCount);
SetLength(Result, (WordLength-1) + CopyLastWordCharCount);
FStream.Read(Result[1+CopyLastWordCharCount], WordLength-1);
if WordLength > 1 then
FStream.Read(Result[1+CopyLastWordCharCount], WordLength-1);
end;
function TChmSearchReader.ReadIndexNodeEntry (ALastWord: String; out AWord: String; out

View File

@ -277,7 +277,7 @@ procedure TChmReader.ReadCommonData;
repeat
Stream.Read(buf, 50);
Result := Result + buf;
until Pos(#0, buf) > -1;
until IndexByte(buf, 50, 0) <> -1;
if FixURL then
Result := StringReplace(Result, '\', '/', [rfReplaceAll]);
end;