I'm adding this note in case anyone else has this issue in the future.
I believe there's a bug in the blob size calculation that can cause badly formed bundles to be sent.
The error is here:
|
len = len + (4 - len % 4); |
This line makes sure the number of bytes in the blob field is divisable by four - as required by the OSC specs. However, if len % 4 == 0, i.e. it's already correct, this line will add four to the len integer when they're not needed.
This then results in four null bytes being added end of the array when the spec calls for 0-3 bytes of padding.
Things may then crash - some OSC receivers will handle this fine, others (like WireShark) will stop parsing the bundle at this point.
I've fixed this in my code using:
if (len % 4 != 0) { len = len + (4 - (len % 4)); }
Hope this helps someone!
I'm adding this note in case anyone else has this issue in the future.
I believe there's a bug in the blob size calculation that can cause badly formed bundles to be sent.
The error is here:
SharpOSC/SharpOSC/OscPacket.cs
Line 398 in 06cfec4
This line makes sure the number of bytes in the blob field is divisable by four - as required by the OSC specs. However, if
len % 4 == 0, i.e. it's already correct, this line will add four to the len integer when they're not needed.This then results in four null bytes being added end of the array when the spec calls for 0-3 bytes of padding.
Things may then crash - some OSC receivers will handle this fine, others (like WireShark) will stop parsing the bundle at this point.
I've fixed this in my code using:
if (len % 4 != 0) { len = len + (4 - (len % 4)); }Hope this helps someone!