[fpc-devel] TFile.ReadAllBytes broken in 3.2.4RC1
Bart
bartjunk64 at gmail.com
Sun Nov 2 13:58:55 CET 2025
Hi,
TFile.ReadAllBytes (in System.IOUtils) seems to alwasy return TBytes
filled with zero's.
It's implemented as
(See: https://gitlab.com/freepascal.org/fpc/source/-/blob/fixes_3_2/packages/vcl-compat/src/system.ioutils.pp?ref_type=heads)
class function TFile.ReadAllBytes(const aPath: string): TBytes;
begin
Result:=[];
With OpenRead(aPath) do
try
SetLength(Result,Size);
ReadBuffer(Result,0); << second param should be "Size"
finally
Free;
end;
end;
This is fixed in main.
https://gitlab.com/freepascal.org/fpc/source/-/commit/9eb77599e18c89bbe426bf272233540206893271
I think it's not been merged to fixes branch,
Shoud I file a bugreport about it?
--
Bart
More information about the fpc-devel
mailing list