mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 02:39:28 +01:00
SynEdit: mitigate endless loop with regex replace and utf8. (regex does not handle utf-8). Issue #40900
This commit is contained in:
parent
b8ec0ec5b3
commit
c4644e5d63
@ -8297,6 +8297,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
|
||||
@ -8306,7 +8310,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