header_rewrite: guard the i == 0 case in HRWSimpleTokenizer - #13672
Merged
masaori335 merged 2 commits intoSep 15, 2026
Merged
Conversation
A value whose first character is '{' or '<' made the tokenizer read
line[-1], so whether the config loaded or was rejected with an opaque
"basic_string" error depended on the adjacent byte. Matches the guard
parse_line already uses for the same idiom.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The only remaining comment is a minor test-coverage nit.
Pull request overview
Guards HRWSimpleTokenizer against out-of-bounds look-behind access at the start of a line.
Changes:
- Adds an
i > 0check before accessingline[i - 1]. - Adds regression coverage for a leading
{.
File summaries
| File | Reviewed changes | Review note |
|---|---|---|
plugins/header_rewrite/parser.cc |
Adds the start-of-line guard. | — |
plugins/header_rewrite/header_rewrite_test.cc |
Adds regression coverage for leading {. |
Nit (2 votes): also cover a leading <. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The i == 0 guard protects both '{' and '<', but only the '{' form was
exercised.
JosiahWI
approved these changes
Sep 15, 2026
JosiahWI
left a comment
Contributor
There was a problem hiding this comment.
I could not find parse_line, but the fix looks good. Thank you!
Contributor
Author
|
Thank you for checking. It's |
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.
A value whose first character is '{' or '<' made the tokenizer read line[-1], so whether the config loaded or was rejected with an opaque "basic_string" error depended on the adjacent byte. Matches the guard parse_line already uses for the same idiom.