# I found a bug in libcanard dsdl compiler

**URL:** <https://forum.opencyphal.org/t/i-found-a-bug-in-libcanard-dsdl-compiler/224>\
**Category:** Libcanard\
**Created:** [October 29, 2018, 10:53am UTC](https://forum.opencyphal.org/t/i-found-a-bug-in-libcanard-dsdl-compiler/224 "2018-10-29T10:53:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cherish-Gww](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/cherish-gww/32/1129_2.png) [@Cherish-Gww](https://forum.opencyphal.org/u/Cherish-Gww)\
**Post date:** [October 29, 2018, 10:53am UTC](https://forum.opencyphal.org/t/i-found-a-bug-in-libcanard-dsdl-compiler/224/1 "2018-10-29T10:53:33Z")

</div>

Hi  
Today I use libcanard dsdl compiler to generate code,  
I fill below in my \*.uavcan files:

uint8[\<=6] command

and I found that in encode,  
uavcan\_xxx\_encode\_internal(source, msg\_buf, offset, 1);  
uavcan\_xxx\_encode\_internal(uavcan\_syrius\_RobotCommand\* source, void\* msg\_buf, uint32\_t offset, uint8\_t root\_item)

Here is root\_item = 1  
and here inside uavcan\_xxx\_encode\_internal  
if (! root\_item)  
{  
// - Add array length  
canardEncodeScalar(msg\_buf, offset, 3, (void\*)&source-\>command.len);  
offset += 3;  
}

I think if (! root\_item) need to be if (root\_item).  
this means that the first 3bits means length of my buffer.

because that in decode, this parameter need it.

Thank you and your team.

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [October 29, 2018, 7:26pm UTC](https://forum.opencyphal.org/t/i-found-a-bug-in-libcanard-dsdl-compiler/224/2 "2018-10-29T19:26:28Z")

</div>

Thanks! Could you please [open an issue in the Libcanard repo](https://github.com/UAVCAN/libcanard/issues/new) and tag `@storola`?
