jhelovuo / RustDDS

Rust implementation of Data Distribution Service
Apache License 2.0
330 stars 66 forks source link

thread 'RustDDS Participant 0 event loop' panicked at 'attempt to subtract with overflow' #277

Closed squizz617 closed 1 year ago

squizz617 commented 1 year ago

Hi,

RustDDS panics while processing a submessage if octets_to_inline_qos field is zero (which is allowed by DDS specification).

Thank you.

jhelovuo commented 1 year ago

Very good find! Thank you for reporting this.

Your analysis seems otherwise correct, except I cannot think of how octets_to_inline_qos could legitimately be zero (or less than 16), so you have crafted a malformed submessage.

In any case, such input should cause just submessage parsing to fail, not a panic, so this is good catch.

This should now be fixed in the latest master commit in Github, and will be included in the next release.

Does it still panic for you?

squizz617 commented 1 year ago

Thank you for confirming and quickly fixing the issue!

I cannot think of how octets_to_inline_qos could legitimately be zero (or less than 16)

You are actually right, and I stand corrected; octets_to_inline_qos cannot legitimately be zero. This indeed is an malformed packet.

Does it still panic for you?

It doesn't panic anymore in the latest master branch. Thank you!