#1 2024-03-27 13:36:40

sgavrilov
Member
Registered: 2019-05-24
Posts: 20

Bug in TTextWriter.AddSpaced

Hello,

It appears that there is a bug in the TTextWriter.AddSpaced (mormot.core.text unit).

procedure TTextWriter.AddSpaced(const Text: RawUtf8; Width: PtrInt; SepChar: AnsiChar);
begin
  AddSpaced(PUtf8Char(pointer(Text)), length(Text));
  if SepChar <> #0 then
    Add(SepChar);
end;

Internal call of the AddSpaced must have one more parameter: Width.

  AddSpaced(PUtf8Char(pointer(Text)), length(Text), Width);

Otherwise a wrong overloaded method is called, which leads to infinite recursion and stack overflow.

Sergey

Offline

#2 2024-03-27 16:34:37

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,684
Website

Re: Bug in TTextWriter.AddSpaced

Offline

Board footer

Powered by FluxBB