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

This commit is contained in:
Pierre Muller 2023-04-12 20:10:44 +02:00
parent 8e7572faba
commit aaf356ba9f

View File

@ -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