MantisBT - opensim
View Issue Details
0008329opensim[GRID] Asset Servicepublic2018-06-13 05:162018-07-11 10:54
evilissimo 
UbitUmarov 
normalmajoralways
resolvedfixed 
LinuxLinux
master (dev code) 
 
Grid (1 Region per Sim)
ubODE
Unknown
Other
0008329: WebUtil: Deserialization failures in LogAndDeserialize
Some servers respond with no ContentLength or -1 when they use Transfer-Encoding: chunked

Here some example:

* Connected to some-assets.server.example.com (666.666.666.666) port 80 (#0)
> GET /assets/803e5f49-9b89-4a0c-9d96-fe2e700092a9/ HTTP/1.1
> Host: some-assets-server.example.com
> User-Agent: curl/7.47.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: some-assets-server.example.com
< Date: Wed, 13 Jun 2018 11:41:25 GMT
< Content-Type: application/xml
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Expires: Wed, 20 Jun 2018 11:41:25 GMT
< Cache-Control: max-age=604800
< X-Cache: MISS
< X-Edge-Location: defr
< Access-Control-Allow-Origin: *
<
....


This will result in a "System.OverflowException: Arithmetic operation resulted in an overflow" when WebUtil.DebugLevel >= 5

in XMLResponseHelper.LogAndDeserialize there's no check if contentLength is actually sane
    byte[] data = new byte[contentLength];

And -1 will cause Util.ReadStream(respStream, data); to raise the above exception.

No tags attached.
patch 0001-WebUtil-Fix-System.OverflowException-for-chunked-con.patch (1,807) 2018-06-13 05:36
http://opensimulator.org/mantis/file_download.php?file_id=4728&type=bug
Issue History
2018-06-13 05:16evilissimoNew Issue
2018-06-13 05:36evilissimoFile Added: 0001-WebUtil-Fix-System.OverflowException-for-chunked-con.patch
2018-06-13 05:37evilissimoStatusnew => patch included
2018-06-13 10:30UbitUmarovNote Added: 0032694
2018-06-13 11:02tampaNote Added: 0032695
2018-06-17 17:09UbitUmarovNote Added: 0032716
2018-07-11 10:54UbitUmarovNote Added: 0032779
2018-07-11 10:54UbitUmarovStatuspatch included => resolved
2018-07-11 10:54UbitUmarovResolutionopen => fixed
2018-07-11 10:54UbitUmarovAssigned To => UbitUmarov

Notes
(0032694)
UbitUmarov   
2018-06-13 10:30   
Transfer-Encoding: chunked is not supported.
your patch may avoid the error caused by missing contentLength, but may not fix contents.
(0032695)
tampa   
2018-06-13 11:02   
From what I understand this just combines the data into one; additional routines should then handle the response depending on what it is, but those already exist to handle a regular response. This just transforms the chunked response into a regular one, no?
(0032716)
UbitUmarov   
2018-06-17 17:09   
added a bit diferente code to httptests branch.
(0032779)
UbitUmarov   
2018-07-11 10:54   
code changed