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

Improve parsing of bracketed expressions #109

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

dag-erling
Copy link
Collaborator

The main purpose of this PR is to fix #51 (out-of-bounds write when parsing bracketed expressions). It also cleans up the surrounding code and fixes a type nit which I missed in #108.

If MBS conversion fails while parsing a bracketed expression, we'd end
up writing '\0' to `buf[-1]`.  Check the result of the conversion.

While here, rewrite `tre_parse_bracket_items()` to return immediately
on error, instead of lazily checking the status later.

This fixes laurikari#51.
Since we now return immediately on error, we don't need an if-else chain.
This allows us to unindent a large swath of code.
I meant to include this in a0cafd4 but forgot.
@dag-erling dag-erling merged commit bd8ca49 into laurikari:master Sep 4, 2024
2 checks passed
@dag-erling dag-erling deleted the des/bracket branch September 5, 2024 12:27
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.

Conversion from wide chars to multibyte chars can fail
1 participant