Hi,
I'm Manuel and I'm working with MARS using the master branch, under Delphi 10.3 release 3 on Windows 10 1909 64 bit.
When build my server under linux 64 bit (Target OS Debian 10 Buster) either like apache module or like linux daemon,
i encurred in an Exception of type Range check error when, in my resources, MARS try to inject a body param of type Array of Record.
And instead when i buil my server as apache module (win32) or windows service (win32) or ISAPI dll (win32) or FMX Application (win32 or win 64)
all working fine.
After a day of investigation i find that the problem come out in the procedure SetArrayLength of unit MARS.Rtti.Utils, and my workaround is to modify the procedure in that way:
//procedure SetArrayLength(var AArray: TValue; const AArrayType: TRttiType; const ANewSize: Integer);
procedure SetArrayLength(var AArray: TValue; const AArrayType: TRttiType; const ANewSize: PNativeInt);
begin
if AArrayType is TRttiArrayType then
begin
raise Exception.Create('Not yet implemented: SetArrayLength TRttiArrayType');
{ TODO -oAndrea : probably not needed }
end
else if AArrayType is TRttiDynamicArrayType then
//DynArraySetLength(PPointer(AArray.GetReferenceToRawData)^, AArrayType.Handle, 1, @ANewSize);
DynArraySetLength(PPointer(AArray.GetReferenceToRawData)^, AArrayType.Handle, 1, ANewSize);
end;
I change the parameter type from Integer to PNativeInt that is exactli the type that DynArraySetLength wants, and then i modify accordling the unit MARS.Core.JSON.pas e MARS.Core.MessageBodyReaders.pas.
After that i rebuild all my project and all working good both under linux and under wndows in all my server deploy kind.
Anyone have had my same problem? My workaround could be a good solutions?
I attached my source of MARS.Rtti.Utils, MARS.Core.JSON.pas e MARS.Core.MessageBodyReaders.pas
MARS.Core.JSON.pas
MARS.Core.MessageBodyReaders.pas
MARS.Rtti.Utils.pas