You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If one of the arguments of a message has the first null terminator on a divide-by-four boundary (index%4==0), then the following argument comes back as nulls. This message fails:
It should produce 2 arguments ("@content", "ch2") but the second one fetches nulls.
Adding this test:
if (index % 4 == 0) index++;
at line 165 of OSCPacket.cs , just before this:
while (index % 4 != 0)
index++;
seems to fix the problem, but I have not tested it extensively.
Otherwise, thank you for a very nice library!
The text was updated successfully, but these errors were encountered:
uckuper
changed the title
Argument is missed when the previous argument's first null falls on a %4 boudary
Argument is missed when the previous argument's first null falls on a %4 boundary
Sep 4, 2018
On second thought, that solution may affect arguments that are not strings. Maybe this might be more appropriate:
case('s'):
string stringVal = getString(msg, index);
arguments.Add(stringVal);
index += stringVal.Length + 1; // added 1 to account for the null
break;
If one of the arguments of a message has the first null terminator on a divide-by-four boundary (index%4==0), then the following argument comes back as nulls. This message fails:
0x2f | 0x43 | 0x6f | 0x6e | 0x74 | 0x72 | 0x6f | 0x6c | 0x2f | 0x53 | 0x63 | 0x65 | 0x6e | 0x65 | 0x73 | 0x2f | 0x73 | 0x63 | 0x31 | 0x00 | 0x2c | 0x73 | 0x73 | 0x00 | 0x40 | 0x63 | 0x6f | 0x6e | 0x74 | 0x65 | 0x6e | 0x74 | 0x00 | 0x00 | 0x00 | 0x00 | 0x63 | 0x68 | 0x32 | 0x00
or in decimal
47 | 67 | 111 | 110 | 116 | 114 | 111 | 108 | 47 | 83 | 99 | 101 | 110 | 101 | 115 | 47 | 115 | 99 | 49 | 0 | 44 | 115 | 115 | 0 | 64 | 99 | 111 | 110 | 116 | 101 | 110 | 116 | 0 | 0 | 0 | 0 | 99 | 104 | 50 | 0
It should produce 2 arguments ("@content", "ch2") but the second one fetches nulls.
Adding this test:
if (index % 4 == 0) index++;
at line 165 of OSCPacket.cs , just before this:
while (index % 4 != 0)
index++;
seems to fix the problem, but I have not tested it extensively.
Otherwise, thank you for a very nice library!
The text was updated successfully, but these errors were encountered: