Skip to content
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

feat(smith): add DocumentBuilder::input_exhausted #430

Merged
merged 1 commit into from
Jan 18, 2023
Merged

feat(smith): add DocumentBuilder::input_exhausted #430

merged 1 commit into from
Jan 18, 2023

Conversation

SimonSapin
Copy link
Contributor

This indicates we might have run into rust-fuzz/arbitrary#139

@SimonSapin
Copy link
Contributor Author

My current attempt at working around rust-fuzz/arbitrary#139 is to double the size of the input until it’s large enough to not be exhausted, but currently this causes DocumentBuilder::operation_definition to overflow the stack, I suspect through generating very deeply nested selection sets.

@SimonSapin
Copy link
Contributor Author

By the way, at first this PR seems unnecessary because DocumentBuilder only borrows &mut Unstructured<'_> so after it is dropped the called should be able to call Unstructured::is_empty themselves. However because DocumentBuilder only has one lifetime parameter and borrows &'a mut Unstructured<'a> with the same 'a in two places. Because something something variance, Unstructured is still considered borrowed when we try to use it. https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=193bdb3f0ffae931f060751c39ef9087 is a reduced test case.

The "proper" fix would be:

struct DocumentBuilder<'a, 'b> {
    u: &'a mut Unstructured<'b>,

… but that changes the signature of the type which would need to be updated at every use, including each impl

@lrlna lrlna merged commit 1f0e983 into main Jan 18, 2023
@lrlna lrlna deleted the empty branch January 18, 2023 13:35
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.

2 participants