fix(stdlib): avoid panic in nom convert_error on lines >= 65535 bytes - #1847
Merged
Conversation
pront
marked this pull request as ready for review
July 7, 2026 18:36
Rust 1.87 capped the fmt width at 0xffff; nom's convert_error panics when a parse error column >= 65536. This affects parse_key_value, parse_cef, decode_mime_q, and parse_ruby_hash. Add safe_convert_error() in the parsing module: delegates to nom_language::error::convert_error for normal inputs; for inputs with a line >= 65535 bytes it returns a plain message with the line and column number instead. Deny direct calls to convert_error via clippy to prevent regressions. Workaround for rust-bakery/nom#1867. Fixes vectordotdev/vector#23606.
pront
force-pushed
the
fix/nom-long-line-panic
branch
from
July 7, 2026 18:58
b1c7b67 to
944fa06
Compare
thomasqueirozb
previously approved these changes
Jul 7, 2026
pront
enabled auto-merge
July 7, 2026 19:29
thomasqueirozb
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The fix adds
parsing::safe_convert_error(): if any line of the input is ≥ 65,535 bytes it returns a plain "line too long" message; otherwise it delegates tonom_language::error::convert_erroras before. All four call sites are updated.The helper is intentionally a workaround pending rust-bakery/nom#1868 (open since Oct 2025, maintainer has limited availability). A comment marks it for removal once that PR lands.
Change Type
Is this a breaking change?
How did you test this PR?
Added a unit test in
parse_key_valuethat constructs a 65,535-byte line with no=delimiter andstandalone_key=false, which forces a nomErr::Errorat EOF. Without the fix this panics; with it the function returnsErr.Ran
cargo fmt,./scripts/clippy.sh, and the fullparse_key_valueunit test suite.Does this PR include user facing changes?
our guidelines.
Changelog fragment:
changelog.d/1848.fix.mdReferences
convert_errorrust-bakery/nom#1868