diff options
Diffstat (limited to 'fuzzers/packfile_fuzzer.c')
-rw-r--r-- | fuzzers/packfile_fuzzer.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/fuzzers/packfile_fuzzer.c b/fuzzers/packfile_fuzzer.c index 50c115755..23ecaf80f 100644 --- a/fuzzers/packfile_fuzzer.c +++ b/fuzzers/packfile_fuzzer.c @@ -12,7 +12,9 @@ #include "git2.h" #include "git2/sys/mempack.h" #include "common.h" -#include "buffer.h" +#include "str.h" + +#include "standalone_driver.h" static git_odb *odb = NULL; static git_odb_backend *mempack = NULL; @@ -53,7 +55,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { git_indexer_progress stats = {0, 0}; git_indexer *indexer = NULL; - git_buf path = GIT_BUF_INIT; + git_str path = GIT_STR_INIT; git_oid oid; bool append_hash = false; @@ -92,26 +94,26 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) fprintf(stderr, "Failed to compute the SHA1 hash\n"); abort(); } - if (git_indexer_append(indexer, &oid, sizeof(oid), &stats) < 0) { + if (git_indexer_append(indexer, &oid.id, GIT_OID_RAWSZ, &stats) < 0) { goto cleanup; } } if (git_indexer_commit(indexer, &stats) < 0) goto cleanup; - if (git_buf_printf(&path, "pack-%s.idx", git_oid_tostr_s(git_indexer_hash(indexer))) < 0) + if (git_str_printf(&path, "pack-%s.idx", git_indexer_name(indexer)) < 0) goto cleanup; - p_unlink(git_buf_cstr(&path)); + p_unlink(git_str_cstr(&path)); - git_buf_clear(&path); + git_str_clear(&path); - if (git_buf_printf(&path, "pack-%s.pack", git_oid_tostr_s(git_indexer_hash(indexer))) < 0) + if (git_str_printf(&path, "pack-%s.pack", git_indexer_name(indexer)) < 0) goto cleanup; - p_unlink(git_buf_cstr(&path)); + p_unlink(git_str_cstr(&path)); cleanup: git_mempack_reset(mempack); git_indexer_free(indexer); - git_buf_dispose(&path); + git_str_dispose(&path); return 0; } |