Repository navigation
[clang] grow biniou input buffers for oversized AST strings - #2336
Merged
Merged
Conversation
Clang can export identifiers and type names longer than the initial AST input buffer.
Biniou's channel reader requires each token to fit and otherwise raises Invalid_argument.
Use a resizing refill callback that preserves unread bytes before delegating the existing
channel refill. Share this reader between piped and saved AST inputs. Geometric growth avoids
repeated small reallocations without buffering the entire stream.
For example, generate a valid identifier that previously crashed capture:
```python
name = "v" + "x" * 70000
print(f"int {name}; int main() {{ return {name}; }}")
```
Limitations: a large token requires a correspondingly large contiguous allocation.
## Test plan
Buffer growth with unread prefixes, multiple larger tokens, exact offsets and truncated-input
EOF; pipe and saved-file capture of a 70001-character identifier with full name preservation;
normal identifier regressions, complete suite and paired corpus reports/summaries.
Contributor
|
biniou_input is declared and only used in tests, is the use coming in another diff? |
Contributor
Author
|
I rechecked the actual capture path with a 70,001-character identifier: both current main and the PR base raise |
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.
Clang can export identifiers and type names longer than the initial AST input buffer.
Biniou's channel reader requires each token to fit and otherwise raises Invalid_argument.
Use a resizing refill callback that preserves unread bytes before delegating the existing
channel refill. Share this reader between piped and saved AST inputs. Geometric growth avoids
repeated small reallocations without buffering the entire stream.
For example, generate a valid identifier that previously crashed capture:
Limitations: a large token requires a correspondingly large contiguous allocation.
Test plan
Buffer growth with unread prefixes, multiple larger tokens, exact offsets and truncated-input
EOF; pipe and saved-file capture of a 70001-character identifier with full name preservation;
normal identifier regressions, complete suite and paired corpus reports/summaries.