#1 2017-10-19 14:51:57

Desenvolvimento
Member
Registered: 2017-09-14
Posts: 6

Possible bug - unit Mormot>TJSONObjectDecoder.Decode method

Hello ab,

I think I found a bug. There is a limit of 64 fields that a table can have, right?

In the unit, Mormot, in the TJSONObjectDecoder.Decode method, line 27448, the number of fields is checked equal to the limit, when you should check if the number of fields is greater than the limit, correct?

       if FieldCount = MAX_SQLFIELDS then
         raise EParsingException.Create ('Too many inlines in TJSONObjectDecoder');

I tested in a table with 64 fields, and when I updated a record, I was getting this error message 'Too many inlines in TJSONObjectDecoder'.

I changed to

       if FieldCount > MAX_SQLFIELDS then
         raise EParsingException.Create ('Too many inlines in TJSONObjectDecoder');

and worked as expected.

What do you think?

PS: If you've already corrected this, ignore it.

tks

Offline

#2 2017-10-20 10:48:54

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

Re: Possible bug - unit Mormot>TJSONObjectDecoder.Decode method

The code is the following:

      inc(FieldCount);
      if FieldCount=MAX_SQLFIELDS then
        raise EParsingException.Create('Too many inlines in TJSONObjectDecoder');

So FieldCount is increasing by one, starting from 0 or 1 (if there was an ID).
Testing FieldCount = MAX_SQLFIELDS is therefore correct.
I don't see any bug here.

Offline

Board footer

Powered by FluxBB