nasa-gcn / gcn-classic-to-json

Convert GCN Classic notices to JSON
Other
0 stars 5 forks source link

ICECUBE_CASCADE last character is not newline #52

Open athish-thiru opened 3 weeks ago

athish-thiru commented 3 weeks ago

There is a general check that the last field of every packet has an ASCII newline character. This check was applied since the newline character should be a standard packet termination character for all notices. This however, does not seem to be the case for ICECUBE_CASCADE notices as trying to generate example.json gives the following error:

AssertionError: Field 39 must be a newline

It seems that the packet simply uses a null character as the termination character:

key = 'ICECUBE_CASCADE'
value = b'\x00\x00\x00\xb0\x00\x00\x00\x01\x00\x00\x00\x00\x00Z\x8a\xe8\x02\r\xf1[\x00\x00O\xe0\x00%\x8ct\x00\x1b\x86\x9a\x00\...96\x00\x00\x00\x00\x00\rq\xcf5042\x00a81\x00\x00\x00\x00eseh406_r_8400nu4931e.4100tv43001864\x00\x0078\x00\x00\x00\x00'
bob-wiegand commented 3 weeks ago

Looks like undefined behavior (memory stomping) in fill_amon_event: https://github.com/nasa-gcn/gcn-classic-notices/blob/4a31bfc77cdd95631bfb175f98d69d599e68b565/src/amon_receiver.c#L9454