Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why isn't stop_on_error enabled by default? #451

Open
Damian-Nordic opened this issue Aug 27, 2024 · 2 comments
Open

Why isn't stop_on_error enabled by default? #451

Damian-Nordic opened this issue Aug 27, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Damian-Nordic
Copy link

I was implementing a CBOR deserialization and I realized that no error was returned by zcbor_check_error when I mistook the type of a CBOR-encoded data item in my decoder function. Then I realized this is due to stop_on_error not being enabled by default in zcbor_new_state.

I don't understand this API choice. Why would I even use zcbor_check_error if I wanted to bypass this check by default?

If there's a reason for that, I would recommend highlighting this in the ZCBOR_STOP_ON_ERROR configuration option documentation at https://github.com/NordicSemiconductor/zcbor as I can see some existing code that apparently doesn't validate the incoming messages properly because of this :).

@oyvindronningstad
Copy link
Collaborator

Thanks, I see that the README is unclear on this. I think making stop_on_error default to true when ZCBOR_STOP_ON_ERROR is enabled makes a lot of sense.

@oyvindronningstad oyvindronningstad added the enhancement New feature or request label Aug 28, 2024
@oyvindronningstad
Copy link
Collaborator

oyvindronningstad commented Sep 17, 2024

Clarified in the docs here, while figuring out a better solution:

#454
zephyrproject-rtos/zephyr#78557

@github-staff github-staff deleted a comment from YeGop0218 Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants