|
|
|
|
|
by RaisingSpear
827 days ago
|
|
I don't quite understand what you're saying, but it should be possible to infer the length from the number of bytes received. Assuming n is an integer: * 5n bytes received = 4n bytes data
* 5n+1 bytes received is [invalid]
* 5n+2 bytes received = 4n+1 bytes data
* 5n+3 bytes received = 4n+2 bytes data
* 5n+4 bytes received = 4n+3 bytes data
This is like modified Base64, which doesn't need any padding. |
|
This comes down to whether there should be 5 valid encodings ("10000", "1000", "100", "10", "1") of a single 0x01 byte, or one. The variable length encoding of integers in Protocol Buffers has the same malleability problem
It's also not clear to me why you say 6 char input is invalid.