Skip to content

Conversation

@davidlenfesty
Copy link
Contributor

In using dynamic arrays in my project, I came across a major issue where the first two elements in an array would be decoded correctly, but any element after that was mangled and useless.

After a few hours of debugging, (and some major help from some friends) we traced it back to the DSDLC-generated decode_internal functions.

Essentially, we found that the loop that decodes each element in the array adds the value returned by the decode_internal function of the internal data structure, which returns the cumulative offset expands way too fast. The offset value is essentially added to itself and the incremented value each time, which means that new elements are essentially placed in arbitrary memory locations.

The encode fix hasn't been entirely tested, but looking at the code it follows with the same logical error as the decoding issue, and changing the += to = fixed the issue entirely in decoding.

@pavel-kirienko pavel-kirienko requested a review from aasmune May 8, 2019 20:27
@pavel-kirienko
Copy link
Member

I am thinking that we should explicitly state in the README that the libcanard's DSDL compiler is unfit for use in production. We are building a new one meanwhile (for UAVCAN v1.0).

@aasmune
Copy link
Contributor

aasmune commented May 8, 2019

I am thinking that we should explicitly state in the README that the libcanard's DSDL compiler is unfit for use in production. We are building a new one meanwhile (for UAVCAN v1.0).

Agree. I will soon have some more time to pick up where we left with Libcanard for v1.0. Do you know the latest status of pydsdlgen?

@pavel-kirienko pavel-kirienko merged commit 9c4b3f7 into OpenCyphal:master May 8, 2019
@pavel-kirienko
Copy link
Member

@aasmune pydsdlgen is very much functional and usable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants