Procházet zdrojové kódy

Avoid read past buffer end for empty source when checking for utf-8 signature

Pierre Muller před 2 roky
rodič
revize
d873fd4e4d
1 změnil soubory, kde provedl 2 přidání a 1 odebrání
  1. 2 1
      compiler/scanner.pas

+ 2 - 1
compiler/scanner.pas

@@ -3721,7 +3721,8 @@ type
                  begin
                    c:=inputpointer^;
                    { eat utf-8 signature? }
-                   if (ord(inputpointer^)=$ef) and
+                   if (bufsize>2) and
+                     (ord(inputpointer^)=$ef) and
                      (ord((inputpointer+1)^)=$bb) and
                      (ord((inputpointer+2)^)=$bf) then
                      begin