fcl-web: SIGSEGV on JSON RPC request without parameters
Original Reporter info from Mantis: Simon Ameis @SAmeis
-
Reporter name: Simon Ameis
Original Reporter info from Mantis: Simon Ameis @SAmeis
- Reporter name: Simon Ameis
Description:
When sending an malformed JSON RPC request to a TJSONRPCModule, the application crashes with SIGSEGV.
Steps to reproduce:
Create a new HTTP application, add a TJSONRPCModule and an TJSONRPCHandler.
Then send the following request to the application
{ "method": "JSONRPCHandler1", "id": 2 }
For a demo application please see attachment.
Additional information:
Exception message. The Address 1 shows only up, when compiling fcl-web with debugging information. Otherwise another address is shown.
[Window Title] Fehler [Content] Projekt httpproject1 hat Exception-Klasse »External: SIGSEGV« ausgelöst. Bei Adresse 1 [Ok]
Call stack:
#0 ?? at :0 #1 TCUSTOMJSONRPCMODULE__HANDLEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\jsonrpc\webjsonrpc.pp:257 #2 TWEBHANDLER__DOCALLMODULE(0x16dbd50, 0x0, 0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\custweb.pp:332 #3 TWEBHANDLER__HANDLEMODULEREQUEST(0x16963c8, 0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\custweb.pp:353 #4 TMODULEFACTORY__DOHANDLEREQUEST(0x16963c8, 0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\fphttp.pp:368 #5 TMODULEITEM__HANDLEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\fphttp.pp:276 #6 THTTPROUTEINTERFACE__DOHANDLEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\httproute.pp:595 #7 THTTPROUTE__HANDLEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\httproute.pp:646 #8 THTTPROUTER__DOROUTEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\httproute.pp:357 #9 THTTPROUTER__ROUTEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\httproute.pp:585 #10 TWEBHANDLER__HANDLEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\custweb.pp:363 #11 TWEBHANDLER__DOHANDLEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\custweb.pp:512 #12 TFPHTTPSERVERHANDLER__HTTPHANDLEREQUEST(0x16dbcb0, 0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\custhttpapp.pp:334 #13 TFPCUSTOMHTTPSERVER__HANDLEREQUEST(0x1724178, 0x17342e8, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\fphttpserver.pp:871 #14 TFPHTTPCONNECTION__HANDLEREQUEST(&LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\fphttpserver.pp:613 #15 TFPCUSTOMHTTPSERVER__DOCONNECT(0x16cbcf0, 0x1696458, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\fphttpserver.pp:824 #16 SSOCKETS$_$TSOCKETSERVER_$__$$_DOCONNECT$TSOCKETSTREAM at :0 #17 SSOCKETS$_$TSOCKETSERVER_$__$$_STARTACCEPTING at :0 #18 TFPCUSTOMHTTPSERVER__STARTSERVERSOCKET(&LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\fphttpserver.pp:859 #19 TFPCUSTOMHTTPSERVER__SETACTIVE(true, &LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\fphttpserver.pp:712 #20 TFPHTTPSERVERHANDLER__RUN(&LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\custhttpapp.pp:470 #21 TCUSTOMWEBAPPLICATION__DORUN(&LtPos;error reading variable>) at C:\FPC\fpcsrc\packages\fcl-web\src\base\custweb.pp:708 #22 CUSTAPP$_$TCUSTOMAPPLICATION_$__$$_RUN at :0 #23 main at httpproject1.lpr:12
The line fpcsrc\packages\fcl-web\src\jsonrpc\webjsonrpc.pp:257 is
&LtPos;pre>AResponse.Content:=Res.AsJSON;&LtPos;/pre> while Res is a TJSONERROROBJECT instance. Thus method function TJSONObject.GetAsJSON gets called.
However I was not able to trace down the root cause of the SIGSEGV.
Mantis conversion info:
- Mantis ID: 35999
- OS: Windows 7, 64 bit
- OS Build: 6.1 SP 1
- Build: trunk
- Platform: Desktop PC
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 42783 (#778ae035).
- Target version: 3.2.0