utzig commented on a change in pull request #2165: FIx: advance_internal should
return error instead of using assert
URL: https://github.com/apache/mynewt-core/pull/2165#discussion_r370594942
##########
File path: encoding/tinycbor/src/cborparser.c
##########
@@ -279,7 +279,9 @@ static CborError advance_internal(CborValue *it)
{
uint64_t length;
CborError err = extract_number(it->parser, &it->offset, &length);
- assert(err == CborNoError);
+ if (err == CborNoError) {
+ return err;
+ }
Review comment:
I was trying to follow the unroll of this error to check that it is handled
somewhere up in the call chain, it seems to be OK. But the same assert is also
being checked inside `cbor_value_enter_container`, should not that one be fixed
as well, for consistency?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services