#1 2024-02-03 00:03:43

tbo
Member
Registered: 2015-04-20
Posts: 328

Bug: AV if returned object has empty string fields

mORMot2, Commit 6984, Delphi XE, 32Bit

If the returned object has empty string fields, an AV occurs. Fields with text content have no problems.

Error message:

An exception of class EAccessViolation with message "Access violation at address 00604E98" has occurred. Reading address 0EFFFFF8 occurred.

The call stack is:

mormot.core.data.TRawUtf8Interning.Unique(???,'',0)
mormot.core.json._JL_RawUtf8($2ACEADC {''},$12EC84)
mormot.core.json._JL_RttiCustomProps('q',$12EC84)
mormot.core.json._JL_RttiCustom('q',$12EC84)
mormot.core.json._JL_RttiObjectWithID('¬ê¬'#2#$12#$F'P',$12EC84)
mormot.core.interfaces.TInterfaceMethodArgument.SetFromJson(...)

JSON looks like this:

'{RowID:0,ActiveState:0,CreatedAt:0,ModifiedAt:0,RecVersion:0,Username:"",Password:""},false]'

Function FastAssignNew in TRawUtf8Interning.Unique() fails:

procedure TRawUtf8Interning.Unique(
...
  if (aText = nil) or
     (aTextLen <= 0) then
    FastAssignNew(aResult)

With values: aText = '' and aTextLen = 0

With best regards
Thomas

Offline

#2 2024-02-03 09:12:56

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

Re: Bug: AV if returned object has empty string fields

Offline

#3 2024-02-03 22:50:44

tbo
Member
Registered: 2015-04-20
Posts: 328

Re: Bug: AV if returned object has empty string fields

ab wrote:

Do you have more clue?

Sorry Arnaud, I made a stupid copy-paste mistake. Everything is fine with mORMot. The nasty thing was, the Delphi debugger totally misled me. I shouldn't work until the middle of the night. The only good thing was that I got some new ideas from all the debugging. Sorry again for the false alarm.

With best regards
Thomas

Offline

#4 2024-02-04 16:19:51

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

Re: Bug: AV if returned object has empty string fields

No problem.
I was just lost in conjectures about the issue.

Providing a MRE in such context is always a good idea.
https://stackoverflow.com/help/minimal- … le-example
It helps a lot.
Or sleeping at night, too. big_smile I understand the problem very well, but since some years I tend to "unplug" at least every night and weekends. wink

Offline

Board footer

Powered by FluxBB