Ran into this issue on a Pi Pico while trying to use this library with the Pico-DMX library.
Lines 61 & 62 in sACN.cpp attempt to verify the postamble of the sacnPacket against predefined values stored in sACNDefs.h. (seen below)
if (sacnPacket[POSTAMBLE_ADDR] != POSTAMBLE[POSTAMBLE_ADDR]) return false;
if (sacnPacket[POSTAMBLE_ADDR + 1] != POSTAMBLE[POSTAMBLE_ADDR + 1]) return false;
In sACNDefs.h, POSTAMBLE_ADDR is defined as 2. When using this index to access data in POSTAMBLE (defined as {0x00, 0x00}), it accesses data outside of that array.
In sACN_Receive there appears to be nothing stored in the memory directly after the POSTAMBLE array, and so the test reads the correct value.
However, in more complex sketches, there is the possibility of other data being stored at that memory address.
Simple fix might be to replace POSTAMBLE_ADDR in the POSTAMBLE index with 0.
EX:
if (sacnPacket[POSTAMBLE_ADDR] != POSTAMBLE[0]) return false;
if (sacnPacket[POSTAMBLE_ADDR + 1] != POSTAMBLE[1]) return false;
Tested in my specific sketch, and works. Not sure if this change would make something else silently fail.
Ran into this issue on a Pi Pico while trying to use this library with the Pico-DMX library.
Lines 61 & 62 in
sACN.cpp
attempt to verify the postamble of thesacnPacket
against predefined values stored insACNDefs.h
. (seen below)In
sACNDefs.h
,POSTAMBLE_ADDR
is defined as 2. When using this index to access data inPOSTAMBLE
(defined as{0x00, 0x00}
), it accesses data outside of that array.In
sACN_Receive
there appears to be nothing stored in the memory directly after thePOSTAMBLE
array, and so the test reads the correct value.However, in more complex sketches, there is the possibility of other data being stored at that memory address.
Simple fix might be to replace
POSTAMBLE_ADDR
in thePOSTAMBLE
index with 0. EX:Tested in my specific sketch, and works. Not sure if this change would make something else silently fail.