#2 Re: mORMot 2 » Default JSON serialisation of character types » 2023-03-17 12:54:25

Thanks, character types are now being serialised as strings, although it doesn't currently escape control characters.

#3 mORMot 2 » Default JSON serialisation of character types » 2023-03-15 14:52:47

stuart
Replies: 4

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.

#5 mORMot 2 » Access Violation in TRestRouter.Lookup when receiving PATCH request » 2023-03-06 14:12:41

stuart
Replies: 2

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.

#6 Re: mORMot 1 » mORMot 2 - Project05HttpDaemon 64bit Error » 2022-03-08 16:12:02

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.

Board footer

Powered by FluxBB