Skip to content

Improve error message content if on long lines #29

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

Merged
merged 2 commits into from
Jan 9, 2022

Conversation

richkadel
Copy link
Collaborator

Improved display of error messages that need to highlight an error on an exceptionally long line (like thousands of opening braces). The error message generator now trims long lines, and still, hopefully always, show an indicator where the error is on that line.

Fixes: #26

This PR addresses two more classes of oss-fuzz failures.

1. A document with many open braces, without closing braces, can
eventually cause program stack overflow. I've added function variations
to set a specific limit, and the existing functions set this value to a
default limit.

2. A document that ends with an extra closing brace could crash the
parser. This is now caught, and a parser error is emitted. This may have
also contributed to an "out-of-memory" error, as the reproducer test
(included with this PR) no longer fails.

I also added better testing support for debugging the parser on sample
documents (such as oss-fuzz reproducers).

Fixes: google#22
Fixes: google#23
Fixes: google#24
@richkadel richkadel requested a review from erickt December 28, 2021 16:20
@richkadel
Copy link
Collaborator Author

@erickt - I split this change out of #27. If you review #27 first, then you can review only the last commit in this PR.

Improved display of error messages that
need to highlight an error on an exceptionally long line (like thousands
of opening braces). The error message generator now trims long lines,
and still, hopefully always, show an indicator where the error is on
that line.

Fixes: google#26
@richkadel richkadel force-pushed the trim-long-error-samples branch from 7a0047c to 3bf19bf Compare December 30, 2021 15:07
@richkadel richkadel merged commit ca65fae into google:master Jan 9, 2022
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.

Improve handling errors by intelligently trimming extremely long lines, when showing the location of the error
2 participants