fix(parser): recover malformed glob fuzz inputs#1126
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b5f1f9517e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Macro CLI Benchmark DeltasCompared Positive deltas mean slower
Aggregate
Flagged aggregate regressions over +5.0%: 1 Per-fixture macro deltas
Largest changesRegressions
Improvements
Non-zero benchmark exit codes
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bcd4bfd3d9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a97cc3d8e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a60f94a815
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 125f2e2615
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a067ee09f8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self.subst_paren_depth > 0 { | ||
| match ch { | ||
| '(' => self.subst_paren_depth += 1, | ||
| ')' => self.subst_paren_depth = self.subst_paren_depth.saturating_sub(1), | ||
| _ => {} |
There was a problem hiding this comment.
Keep comment state inside command substitutions
When recovery scans a malformed conditional that enters $(), this branch decrements subst_paren_depth for every ) without recognizing comments inside the substitution. For inputs such as [[ x =~ { $(echo # )\n]]) ]], the ) on the commented line is not the substitution close, but the scanner drops back to top level and accepts the following ]] from inside the substitution as the conditional terminator, so recovery resumes in the middle of $() instead of after the real close.
Useful? React with 👍 / 👎.
| if state.is_plain_top_level() | ||
| && state.at_token_start | ||
| && raw_token_ends_at(self.input, offset, "]]") | ||
| { | ||
| return Some(offset + "]]".len()); |
There was a problem hiding this comment.
Track process substitutions during raw recovery
When a malformed [[ ... ]] recovery scan starts before a process substitution, the raw state never enters a nested context for <(...) or >(...), so a token-start ]] inside that substitution is accepted here as the conditional close. For example, [[ x =~ { <(echo ]]) ]] makes recovery resume before the process substitution's ) instead of after the real ]], leaving the rest to be parsed as unrelated syntax.
Useful? React with 👍 / 👎.
| if raw_keyword_starts_at(self.input, offset, "esac") { | ||
| if state.case_depth == 0 { | ||
| return Some(offset + "esac".len()); |
There was a problem hiding this comment.
Ignore heredoc bodies when finding case ends
When malformed case recovery scans a body that starts a heredoc, this raw keyword check still treats an esac line inside the heredoc payload as the compound terminator. For example, after a bad arm followed by cat <<EOF\nesac\nEOF\nesac, recovery stops at the heredoc content instead of the real esac, so the lexer resumes from the middle of the heredoc and parses the remaining delimiter/body as top-level text.
Useful? React with 👍 / 👎.
Summary
Verification