OpenCyphal / pycyphal

Python implementation of the Cyphal protocol stack.
https://pycyphal.readthedocs.io/
MIT License
119 stars 106 forks source link

[legacy-v0] transport.py: Fix endianness of dynamic array lengths #121

Closed pcarranzav2 closed 4 years ago

pcarranzav2 commented 4 years ago

Dynamic array lengths are encoded as any other scalar, so when they're decoded/encoded we should make sure they're read/written as little endian scalars. This change fixes the fact that converting binary strings to/from ints assumes the string is in big endian representation, so arrays with max length over 256 would be incorrectly encoded.

pcarranzav2 commented 4 years ago

@pavel-kirienko thanks for the lightning-fast response!

pavel-kirienko commented 4 years ago

yeah this is rather unusual for me