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

Safe unmarshal #121

Merged
merged 2 commits into from
Nov 30, 2023
Merged

Safe unmarshal #121

merged 2 commits into from
Nov 30, 2023

Conversation

chriso
Copy link
Contributor

@chriso chriso commented Nov 30, 2023

The deserialization layer panics on invalid input. Bad state can take down the entire program currently.

This PR updates (*coroutine.Context).Unmarshal to catch these panics and return an error value, allowing the caller to gracefully handle bad input.

A better long term solution would be to abandon the deserialize*() functions and instead build the deserialization layer on the scanner introduced in #116, which avoids panics in many cases and could be updated to avoid panics in all cases.

@chriso chriso merged commit b3b03b5 into main Nov 30, 2023
2 checks passed
@chriso chriso deleted the safe-unmarshal branch November 30, 2023 23:24
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.

2 participants