bergzand / NanoCBOR

CBOR library aimed at heavily constrained devices
Creative Commons Zero v1.0 Universal
47 stars 23 forks source link

Decoder: Don't decrement remaining in _enter_container #54

Closed bergzand closed 3 years ago

bergzand commented 3 years ago

The _value_match_exact call decrements the nanocbor_value_t::remaining member when it decodes an indefinite array or map. This should not happen. This PR adds const to the outer nanocbor_value_t argument of the enter container functions and makes sure that they are not modified in the functions.

This should fix the issue described in #52 and #53.

A test to ensure to test the (non-)indefinite maps/arrays in a mixed scenario is added.