mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 01:57:57 +02:00
SynEdit: mitigate endless loop with regex replace and utf8. (regex does not handle utf-8). Issue #40900
(cherry picked from commit c4644e5d63
)
This commit is contained in:
parent
e964bd179b
commit
c41a93243a
@ -8279,6 +8279,10 @@ begin
|
||||
//DebugLn(['TCustomSynEdit.SearchReplace FOUND ptStart=',dbgs(ptStart),' ptEnd=',dbgs(ptEnd),' ptFoundStart=',dbgs(ptFoundStart),' ptFoundEnd=',dbgs(ptFoundEnd)]);
|
||||
// check if found place is entirely in range
|
||||
ZeroLen := ptFoundStart = ptFoundEnd;
|
||||
if ssoRegExpr in AOptions then begin
|
||||
ptFoundStart.X := FTheLinesView.LogicPosAdjustToChar(FTheLinesView[ToIdx(ptFoundStart.Y)], ptFoundStart.X, False);
|
||||
ptFoundEnd.X := FTheLinesView.LogicPosAdjustToChar(FTheLinesView[ToIdx(ptFoundEnd.Y)], ptFoundEnd.X, True);
|
||||
end;
|
||||
if ( (not SelIsColumn) or
|
||||
( (ptFoundStart.Y=ptFoundEnd.Y) and
|
||||
(ptFoundStart.X >= ReplaceBlockSelection.ColumnStartBytePos[ptFoundStart.Y]) and
|
||||
@ -8288,7 +8292,8 @@ begin
|
||||
not( ZeroLen and (ptStart = ptFoundStart) and
|
||||
(ssoFindContinue in AOptions) and (not SelAvail)
|
||||
)
|
||||
)
|
||||
) and
|
||||
( ZeroLen = (ptFoundStart = ptFoundEnd) )
|
||||
then
|
||||
begin
|
||||
// pattern found
|
||||
|
Loading…
Reference in New Issue
Block a user