浏览代码

Don't trigger range check error in PathLastChar.

There was no actual out-of-range access and this didn't affect established projects at all (where range checking is never enabled), but it could be seen in new projects.

The PathStrPrevChar call was only relevant to DBCS in non-Unicode builds.
Jordan Russell 5 月之前
父节点
当前提交
147a5aaadc
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      Components/PathFunc.pas

+ 4 - 2
Components/PathFunc.pas

@@ -2,7 +2,7 @@ unit PathFunc;
 
 {
   Inno Setup
-  Copyright (C) 1997-2024 Jordan Russell
+  Copyright (C) 1997-2025 Jordan Russell
   Portions by Martijn Laan
   For conditions of distribution and use, see LICENSE.TXT.
 
@@ -47,6 +47,8 @@ function RemoveBackslashUnlessRoot(const S: String): String;
 
 implementation
 
+{$ZEROBASEDSTRINGS OFF}
+
 uses
   Windows, SysUtils;
 
@@ -386,7 +388,7 @@ begin
   if S = '' then
     Result := nil
   else
-    Result := PathStrPrevChar(Pointer(S), @S[Length(S)+1]);
+    Result := @S[High(S)];
 end;
 
 function PathLastDelimiter(const Delimiters, S: string): Integer;