You are not logged in.
Pages: 1
That's fixed it, thanks!
Thanks, character types are now being serialised as strings, although it doesn't currently escape control characters.
Is there a way to customise the default JSON serialisation of character types? Specifically, I'd like them to be serialised to JSON strings rather than numbers and wondered if there are any options for this?
I know I can register a custom serialiser using TRttiJson.RegisterCustomSerializer, but then I need to do this for each distinct character type, so a way to customise the default would be preferable.
Excellent, that's fixed it, thanks!
If I build and run the MVCServer example project in ex\mvc-blog and send a PATCH request to http://localhost:8092/blog/mvc-info, I get an access violation in TRestRouter.Lookup in mormot.rest.server:
// find the matching node in the URI Radix Tree
result := nil;
if (self = nil) or
(Ctxt = nil) or
(Ctxt.Call^.Url = '') or
(Ctxt.Method < low(fTree)) or
(Ctxt.Method > high(fTree)) then
exit;
p := pointer(Ctxt.Call^.Url);
if p^ = '/' then
inc(p);
result := pointer((fTree[Ctxt.Method].Root as TRestTreeNode).Lookup(p, Ctxt)); //<-- AV here.
Target: Win32
Configuration: Debug
OS: Windows 10.
The problem seems to be the ServiceProc procedure in mormot.core.os.windows.inc:
procedure ServiceProc(ArgCount: cardinal; Args: PPChar); stdcall;
var
i: PtrInt;
begin
if not Assigned(ServiceSingle) then
exit;
SetLength(ServiceSingle.fArgsList, ArgCount - 1);
for i := 0 to ArgCount - 2 do //<- problem here
begin
Inc(Args);
ServiceSingle.fArgsList[i] := Args^;
end;
Because i is a 64-bit int and ArgCount is a cardinal, if ArgCount is less than 2 then the for loop termination value wraps around to a very high number and causes it to try to process arguments that don't exist.
Pages: 1