-
Notifications
You must be signed in to change notification settings - Fork 27
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
Custom Brotli Dictionaries #212
Conversation
fuzzing for brotli
Compress Validator Modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple small remarks.
/// Points to data owned by Go. | ||
ptr: *mut u8, | ||
/// The length in bytes. | ||
len: *mut usize, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me why the len is also a pointer - couldn't it just be a usize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added another comment :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right; I somehow missed that that actually happened. The comment probably isn't necessary; should be implied by the type; I just missed it.
/// Returns a pointer to a compression-ready instance of the given dictionary. | ||
pub fn ptr(&self, level: u32) -> Option<*const EncoderPreparedDictionary> { | ||
match self { | ||
Self::StylusProgram if level == 11 => Some(STYLUS_PROGRAM_DICT.0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the check if level == 11
? brotli can still use a custom dictionary at lower levels can't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems you need a different dictionary for each level. Ours is a level 11 and that's what cargo stylus
uses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You know, we should probs make this return a result given that. I'll add a commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see what you mean. The binary dictionary we supply isn't level-specific, but the thing prepared by BrotliEncoderPrepareDictionary
is. In that case it seems like maybe we'd want to either allow the possibility to prepare dictionaries at other levels, or else only allow compression at level 11. But I don't have a strong opinion; as-is is fine with me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; I did leave another couple remarks.
Adds support for custom brotli dictionaries, allowing us to dramatically cut Stylus contract sizes.
Resolves STY-67