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

Simplify interface between BinEncoder and MaximalBuf #1802

Merged
merged 5 commits into from Oct 17, 2022
Merged

Conversation

djc
Copy link
Collaborator

@djc djc commented Oct 16, 2022

The enforced_write() method defined a pretty complex (and likely slow) interface contract. Add two separate methods to MaximalBuf to replace all uses of enforced_write(). This should fix the issue discovered in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52334. At this point I'm not exactly sure in the root cause of the original issue (the fuzzed test case is still quite large), but I'm much more confident in the revised API.

@djc djc requested a review from bluejekyll October 16, 2022 20:42
Copy link
Member

@bluejekyll bluejekyll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall this looks good. I do think it's worth deduping the code with reserve and write where applicable, unless you have a good reason not to do that.

Also, did you mean to checkin the fuzzing data?

crates/proto/src/serialize/binary/encoder.rs Show resolved Hide resolved
Copy link
Member

@bluejekyll bluejekyll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning this up. It looks like a good change.

@bluejekyll bluejekyll merged commit 83aea01 into main Oct 17, 2022
@bluejekyll bluejekyll deleted the fuzz-bounds branch October 17, 2022 13:11
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.

None yet

2 participants