config: Port config_file_fuzzer to the new in-memory backend.#4842
Merged
pks-t merged 3 commits intolibgit2:masterfrom Oct 12, 2018
Merged
config: Port config_file_fuzzer to the new in-memory backend.#4842pks-t merged 3 commits intolibgit2:masterfrom
pks-t merged 3 commits intolibgit2:masterfrom
Conversation
pks-t
requested changes
Oct 11, 2018
fuzzers/config_file_fuzzer.c
Outdated
| if (written < 0) | ||
| continue; | ||
| total += written; | ||
| err = git_config_backend_from_string(&backend, (const char*)data, size); |
Member
There was a problem hiding this comment.
Nit: there's a space missing between const char and *) and same style comment as above
| abort(); | ||
| err = git_config_new(&cfg); | ||
| if (err != 0) { | ||
| goto out; |
Member
There was a problem hiding this comment.
Style nit: if (err = git_config_new(&cfg)) < 0)
fuzzers/config_file_fuzzer.c
Outdated
| if (err != 0) { | ||
| goto out; | ||
| } | ||
| // Now owned by the config |
Member
There was a problem hiding this comment.
Oops. Seems like we aren't yet enforcing C90 for our fuzzing targets. I'm creating a PR for that. This should then be /* Now owned by the config */.
Member
There was a problem hiding this comment.
Weird, we are enforcing C90. Would've expected it to at least throw a warning...
src/config_mem.c
Outdated
| } | ||
|
|
||
| if (git_buf_sets(&backend->cfg, cfg) < 0) { | ||
| if (git_buf_put(&backend->cfg, cfg, len) < 0) { |
Member
There was a problem hiding this comment.
This shouldn't be a put but a git_buf_set instead. Put would append the string, while set will replace the current string.
| * @param len the length of the string pointed to by `cfg` | ||
| */ | ||
| extern int git_config_backend_from_string(git_config_backend **out, const char *cfg); | ||
| extern int git_config_backend_from_string(git_config_backend **out, const char *cfg, size_t len); |
Member
|
Thank you! |
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.
In quick testing, I see this hitting up to about 10k exec/s starting with an empty corpus on one core of my laptop, versus about 1500 for the old one.