Closed Firionus closed 4 years ago
The crate currently allows construction of ArtDmx packets where the length field does not equal the length of the Data field:
let artnet_protocol_packet = ArtCommand::Output(Output { length: 3, data: vec![0xff, 0xff], ..Output::default() });
This should not be possible. I think setting the length field should be done automatically by artnet_protocol.
artnet_protocol
The Art-Net Spec says on page 48 that the Length
should be an even number in the range 2 – 512.
Currently, ArtDmx packets can be constructed with
These should all be impossible to construct.
In case of uneven length I think we should pad with a zero to the next even number. For example if the user wants to send vec![0xff, 0xff, 0xff], I think we should automatically pad with a zero to get vec![0xff, 0xff, 0xff, 0x00].
vec![0xff, 0xff, 0xff]
vec![0xff, 0xff, 0xff, 0x00]
Closed in #8
length != data.len()
The crate currently allows construction of ArtDmx packets where the length field does not equal the length of the Data field:
This should not be possible. I think setting the length field should be done automatically by
artnet_protocol
.wrong length DMX Data
The Art-Net Spec says on page 48 that the Length
Currently, ArtDmx packets can be constructed with
These should all be impossible to construct.
In case of uneven length I think we should pad with a zero to the next even number. For example if the user wants to send
vec![0xff, 0xff, 0xff]
, I think we should automatically pad with a zero to getvec![0xff, 0xff, 0xff, 0x00]
.