]> git.proxmox.com Git - libgit2.git/blobdiff - fuzzers/packfile_fuzzer.c
New upstream version 1.4.3+dfsg.1
[libgit2.git] / fuzzers / packfile_fuzzer.c
index 50c11575524f81c7add893c314e66ad733adc689..6002fa1de8f1f0bb6979ddef778c9de3b3a5b42b 100644 (file)
@@ -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;
 
@@ -99,19 +101,19 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
        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;
 }