ソースを参照

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

git-svn-id: trunk@22499 -

marco 13 年 前
コミット
5866e2435c
2 ファイル変更3 行追加2 行削除
  1. 2 1
      packages/chm/src/chmfiftimain.pas
  2. 1 1
      packages/chm/src/chmreader.pas

+ 2 - 1
packages/chm/src/chmfiftimain.pas

@@ -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

+ 1 - 1
packages/chm/src/chmreader.pas

@@ -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;