aws/aws-xray-daemon

Nil pointer dereference when the daemon receives an invalid message

trossyvormes opened this issue · 7 comments

Sending a message like {"format":"json","version":1}\nx to the daemon crashes it with a segmentation violation (nil pointer dereference) here:

traceIdStrs := traceIdRegexp.FindStringSubmatch(batchesMap[*unprocessedSegment.Id])

unprocessedSegment.Id is a pointer to 0x0.

r is set to:

{
  UnprocessedTraceSegments: [{
      ErrorCode: "ParseError",
      Message: "Invalid segment. ErrorCode: ParseError"
    }]
}

An invalid message can be sent to the daemon by way of bugs in the SDKs (for example, aws/aws-xray-sdk-python#288)

Hi trossyvormes,

Which version of the daemon are you using?

3.3.0 from Docker Hub amazon/aws-xray-daemon:latest. I have also reproduced it on commit 05ec997.

Hi trossyvormes,

Thank you for the quick response.
Any issues with 3.2.0? Or is this entirely new?

I just attempted to reproduce on 3.2.0 from Docker Hub and could not.

Python code to reproduce:

import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setblocking(0)
sock.sendto('{"format":"json","version":1}\nx'.encode("utf8"), ("127.0.0.1", 2000))

Thanks for reporting this!

We have released a fix for this in Daemon release 3.3.1 - https://github.com/aws/aws-xray-daemon/releases/tag/v3.3.1
Please let us know if this has been resolved on your end.

Will close this issue in a few days.

Confirmed it is fixed on 3.3.1.