[70206 Closed] Stack overflow when uploading file to SuperServer

We are having an issue when uploading a file to TROIpSuperHTTPServer when the file is over 1MB.

This is under Delphi XE and the latest version of RO (although it happens in previous versions.
MaxPackageSize property of the SuperServer (TROIpSuperHTTPServer) is set to 20971520.

When sending aan image (size: 1051 KB) a stack overflow error is happening (Exception class EStackOverflow with message ‘Stack overflow’.) in then HeaderValid function of TBinHeader which is called from IsValidSuperHttpRequest function of TROBaseSuperHTTPServer, which is called from IncomingData function of TROBaseSuperHTTPServer

Any ideas?

Thanks

can you create a simple testcase that reproducing this problem, pls?
this is system exception:
EStackOverflow = class(EExternal)
end deprecated;
our components don’t raise EStackOverflow exception at all, so it can be a corner case.

I have a demo project, where shall I send it?

before I forget break points were

line 1231 in uROBaseSuperHttpServer
line 1106 in uROBaseSuperHttpServer‏

you can attach it here or send directly to support@remobjects.com

Thanks. That has been sent - No it hasn’t Marvin said it was too big, so I have sent it without the test upload files - yo’ll have to find your own :wink:

Thanks, logged as bugs://70206: Problem with converting TBytes to ‘array of byte’

bugs://70206 got closed as fixed for release DA8.2

as a workaround, update uROBaseSuperHttpServer.pas as

function TROBaseSuperHTTPServer.IsValidSuperHttpRequest(
  aRequest: TDynamicByteArray): Boolean;
var
  k: PByteArray;
begin
  Result := Length(aRequest) > 0;
  if Result then begin
    k := PByteArray(@aRequest[0]);
    if (Length(aRequest) < 16 + 1) or     // schttp message size always > 17
        TROMessage.HasEnvelope(k^) or    // message envelope header isn't found
        TBinHeader.HeaderValid(k^) then  // bin message header isn't found
      Result := False
    else
      Result := aRequest[16] in [ShHello..ShAsyncWait];
  end;
end;

Thanks. That has done the trick.