From 65f647e25b29061e378c1b60e34eca70a13cd337 Mon Sep 17 00:00:00 2001 From: Juha Date: Sun, 15 Sep 2024 07:26:21 +0300 Subject: [PATCH] Codetools: Prevent another range check error. Issue #40922, patch by WooBean007. --- components/codetools/basiccodetools.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/codetools/basiccodetools.pas b/components/codetools/basiccodetools.pas index 3e463e1265..1ddcc6221a 100644 --- a/components/codetools/basiccodetools.pas +++ b/components/codetools/basiccodetools.pas @@ -1825,7 +1825,7 @@ begin dec(IdentStart); if (IdentStart>1) and (Source[IdentStart-1]='&') then dec(IdentStart); - if (IdentEnd<=length(Source)) and (Source[IdentEnd]='&') then + if (IdentEnd<=length(Source)) and (Source[IdentEnd]='&') then inc(IdentEnd); while (IdentEnd<=length(Source)) and (IsIdentChar[Source[IdentEnd]]) do @@ -1836,7 +1836,7 @@ begin and (not IsIdentStartChar[Source[IdentStart]]) do inc(IdentStart); - if (IdentStart>0) and (Source[IdentStart]='&') then begin + if (IdentStart>0) and (IdentStart<=length(Source)) and (Source[IdentStart]='&') then begin if (IdentStart>length(Source)) or not IsIdentStartChar[Source[IdentStart+1]] then IdentEnd:=IdentStart; end else