Browse Source

Editor fix memory access out of bounds.

Margers 1 week ago
parent
commit
ea548eaa56
1 changed files with 3 additions and 0 deletions
  1. 3 0
      packages/fv/src/editors.inc

+ 3 - 0
packages/fv/src/editors.inc

@@ -1654,6 +1654,8 @@ begin
     end;
     end;
   end;
   end;
   P:=T+P;
   P:=T+P;
+  if P > BufLen then
+    P:=BufLen;
 {$else}
 {$else}
   Pos := 0;
   Pos := 0;
   while (Pos < Target) and (P < BufLen) and  not(BufChar (P) in [#10,#13]) do
   while (Pos < Target) and (P < BufLen) and  not(BufChar (P) in [#10,#13]) do
@@ -2159,6 +2161,7 @@ var idxpos : sw_word;
       EGC: Sw_String;
       EGC: Sw_String;
 {$endif FV_UNICODE}
 {$endif FV_UNICODE}
   begin
   begin
+     calPositions:=0;
      if iB = 0 then exit;
      if iB = 0 then exit;
      if bStr[iB]<>#13 then  { not end char add one }
      if bStr[iB]<>#13 then  { not end char add one }
      begin
      begin