Skip to content

Commit

Permalink
Fixed Mantis #6634: Access violation in JvJCLUtils: GetWordOnPos2
Browse files Browse the repository at this point in the history
  • Loading branch information
ahausladen committed Oct 2, 2018
1 parent 610f9d9 commit dfd5ee6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jvcl/run/JvJCLUtils.pas
Expand Up @@ -1465,7 +1465,7 @@ function GetWordOnPosW(const S: WideString; const P: Integer): WideString;
function GetWordOnPos2(const S: string; P: Integer; var iBeg, iEnd: Integer): string;
begin
Result := '';
if P < 1 then
if (P > Length(S)) or (P < 1) then
Exit;
if CharInSet(S[P], Separators) and ((P < 1) or CharInSet(S[P - 1], Separators)) then
Inc(P);
Expand All @@ -1491,7 +1491,7 @@ function GetWordOnPos2(const S: string; P: Integer; var iBeg, iEnd: Integer): st
function GetWordOnPos2W(const S: WideString; P: Integer; var iBeg, iEnd: Integer): WideString;
begin
Result := '';
if P < 1 then
if (P > Length(S)) or (P < 1) then
Exit;
if CharInSetW(S[P], Separators) and
((P < 1) or (CharInSetW(S[P - 1], Separators))) then
Expand Down

0 comments on commit dfd5ee6

Please sign in to comment.