#1 2019-01-03 22:33:10

mapes
Member
Registered: 2016-10-30
Posts: 16

TDynArray sort AV

Hi,

If I add empty string to array,
sorting the array causes AV.

rev 1.18.4885

  procedure foo;
  var Ar: TStringDynArray;
      s: String;
      AK: TDynArray;
  begin
    AK.Init(TypeInfo(TStringDynArray),Ar);
    s := 'a';
    AK.Add(s);
    s := '';
    AK.Add(s);
    AK.Sort(SortDynArrayString);
  end;

Offline

#2 2019-01-04 11:57:26

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

Re: TDynArray sort AV

It is due to a bug in Delphi 2009+ RTL's SysUtils.StrComp() function.
The bug doesn't exist with FPC or e.g. Delphi 7/2007.

See https://synopse.info/fossil/info/263e2e02fb

Thanks for the report!

Offline

Board footer

Powered by FluxBB