osc icon indicating copy to clipboard operation
osc copied to clipboard

First osc arg with 4 char string causes decode bug

Open bpostlethwaite opened this issue 3 years ago • 7 comments

  var msg = OSCMessage("/dun/dap", arguments: ["aaaa", 1, 2]);
  var bytes = msg.toBytes();
  var msg2 = OSCMessage.fromBytes(bytes);
  print(msg2.toString());

prints

OSCMesssage(/dun/dap, args: [aaaa, 0, 1])

Note the 0 as the first argument.

bpostlethwaite avatar Apr 25 '21 18:04 bpostlethwaite

Actually same with other combinations such as

var msg = OSCMessage("/set", arguments: ["/dun/dap", 3, 3]);
OSCMesssage(/set, args: [/dun/dap, 0, 3])

bpostlethwaite avatar Apr 25 '21 18:04 bpostlethwaite

I tested another OSC implementation and that implementation receives bytes from this library OK which makes me believe it is in the decoding.

bpostlethwaite avatar Apr 25 '21 18:04 bpostlethwaite

~Actually this appears to be fixed on the most recent master commit. When cloning this lib and installing from path, it works.~

bpostlethwaite avatar Apr 25 '21 20:04 bpostlethwaite

Found the location of the error (line: 336 of convert.dart)

      //  if (value is String) eat(byte: 0);

remove the comment and eating the padded string bytes fixes the issue. Not sure if it causes others.

bpostlethwaite avatar Apr 25 '21 20:04 bpostlethwaite

Thanks for tracking this down! @jeffmikels: it looks like that change goes back to some parsing fixes you landed (https://github.com/pq/osc/commit/e1e4662d9b598fdb14666992cdbce723c29c0c64). Any thoughts?

pq avatar Apr 26 '21 19:04 pq

I'll look into it.

jeffmikels avatar Apr 26 '21 23:04 jeffmikels

Thanks!

pq avatar Apr 26 '21 23:04 pq