TCustomBufDataset.GetFieldSize is faulty for ftGuid
function TCustomBufDataset.GetFieldSize(FieldDef : TFieldDef) : longint; at bufdataset.pas goes like this
case FieldDef.DataType of
ftUnknown : result := 0;
ftString,
ftGuid,
ftFixedChar: result := FieldDef.Size*FieldDef.CharSize + 1;
The problem here is that "ftGuid" returns CharSize = 0. (because CharSize is non-zero only for strings) as a result "ftGuid" size of the buffer is always 1.
Even though the database connection provides the proper size. (i.e. for PostgreSQL it's 38 bytes).
Eventually this is causing heap corruption and application crash.
Naturally the expected fix might look like this:
case FieldDef.DataType of
ftUnknown : result := 0;
ftGuid: result := FieldDef.Size + 1;
ftString,
ftFixedChar: result := FieldDef.Size*FieldDef.CharSize + 1;
or to update TFieldDef.GetCharSize: Word; and add extra byte for ftGuid.
The purpose of "+ 1" is unknown. (assuming it's used to store null-terminating character)