#1 2015-08-31 09:07:39

alpinistbg
Member
Registered: 2014-11-12
Posts: 124

Bug in mORMot.pas

Hi ab,

There is a bug in TSQLRestBatch.Update() method, preventing it work with IDs bigger than 2^31-1.

function TSQLRestBatch.Update(Value: TSQLRecord;
  const CustomFields: TSQLFieldBits; DoNotAutoComputeFields: boolean): integer;
var Props: TSQLRecordProperties;
    FieldBits: TSQLFieldBits;
    ID, tableIndex: integer;
begin
  result := -1;
  if (Value=nil) or (fBatch=nil) then
    exit;
  ID := Value.IDValue;
  if (ID<=0) or not fRest.RecordCanBeUpdated(Value.RecordClass,ID,seUpdate) then
    exit; // invalid parameters, or not opened BATCH sequence

The local variable ID is declared integer while Value.IDValue is of type TID. Bigger values cause overflow and the subsequent if treats it as a negative value.

Regards,

Offline

#2 2015-08-31 09:25:55

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

Re: Bug in mORMot.pas

Indeed.

Should be fixed by http://synopse.info/fossil/info/94cb62ea3e

Thanks for the report!

Online

Board footer

Powered by FluxBB