mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
object: lookup sha256 objects
This is much of the plumbing for the object database to support SHA256, and for objects to be able to parse SHA256 versions of themselves.
This commit is contained in:
@@ -39,7 +39,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
* to do.
|
||||
*/
|
||||
for (i = 0; i < ARRAY_SIZE(types); i++) {
|
||||
if (git_object__from_raw(&object, (const char *) data, size, types[i]) < 0)
|
||||
if (git_object__from_raw(&object, (const char *) data, size, types[i], GIT_OID_SHA1) < 0)
|
||||
continue;
|
||||
git_object_free(object);
|
||||
object = NULL;
|
||||
|
||||
@@ -67,6 +67,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
git_str path = GIT_STR_INIT;
|
||||
git_oid oid;
|
||||
bool append_hash = false;
|
||||
int error;
|
||||
|
||||
if (size == 0)
|
||||
return 0;
|
||||
@@ -82,7 +83,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
||||
abort();
|
||||
}
|
||||
|
||||
if (git_indexer_new(&indexer, ".", 0, odb, NULL) < 0) {
|
||||
#ifdef GIT_EXPERIMENTAL_SHA256
|
||||
error = git_indexer_new(&indexer, ".", GIT_OID_SHA1, NULL);
|
||||
#else
|
||||
error = git_indexer_new(&indexer, ".", 0, odb, NULL);
|
||||
#endif
|
||||
|
||||
if (error < 0) {
|
||||
fprintf(stderr, "Failed to create the indexer: %s\n",
|
||||
git_error_last()->message);
|
||||
abort();
|
||||
|
||||
Reference in New Issue
Block a user