Commit a1d5fd06 by Patrick Steinhardt

fuzzers: add object parsing fuzzer

Add a simple fuzzer that exercises our object parser code. The fuzzer
is quite trivial in that it simply passes the input data directly to
`git_object__from_raw` for each of the four object types.
parent 6562cdda
tree 3e7ac388cadae960fe7e22175ce0da878afe9d18
parent 8b89f362a34fcccdf1c6c5f3445895b71d9c6d56
parent c590b41fe4057a84a9bd31a5605ceef2c309b0f8
author Patrick Steinhardt <ps@pks.im> 1538760730 +0200
committer GitHub <noreply@github.com> 1538760730 +0200
gpgsig -----BEGIN PGP SIGNATURE-----
wsBcBAABCAAQBQJbt6AaCRBK7hj4Ov3rIwAAdHIIAKZGIpS0dAirVRt5NVFj3ZtC
o2Q3ADC0XpYLKkEsClhG7pVtr7MRZZ8+qaJpbxn9j9WZZ4UtEeDjseos+pMNn9Mf
OQQntNzGAbHSw0apyYT+mTUKaVONPev4fw9Lnc/RJ/iWwHx+4gmgNqLwV3foaCW9
w1JzCL+BVJyZI80jrEehihhUnpIUOuMBwGjzSt54Zn5JqviC4cIldF2sXFGQqvsq
3WDNnEUYanU6cLAdb9Pd6bVBI1EJnRLxehSeYiSaRPmLhQyhkH8KZ5lSi8iuH1C4
bjA6HaEUwCeq0k9Le6BUu93BExEOFcuu8+zEKCrwCdSwdEQ3Iakv8dh7XlT9iUY=
=nGP0
-----END PGP SIGNATURE-----
Merge pull request #4834 from pks-t/pks/v0.27.5
Security release v0.27.5
\ No newline at end of file
object a8d447f68076d1520f69649bb52629941be7031f
type commit
tag testtag
tagger Patrick Steinhardt <ps@pks.im> 1539253015 +0200
Tag message
/*
* libgit2 packfile fuzzer target.
*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "git2.h"
#include "object.h"
#define UNUSED(x) (void)(x)
int LLVMFuzzerInitialize(int *argc, char ***argv)
{
UNUSED(argc);
UNUSED(argv);
if (git_libgit2_init() < 0)
abort();
return 0;
}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
const git_otype types[] = {
GIT_OBJ_BLOB, GIT_OBJ_TREE, GIT_OBJ_COMMIT, GIT_OBJ_TAG
};
git_object *object = NULL;
size_t i;
/*
* Brute-force parse this as every object type. We want
* to stress the parsing logic anyway, so this is fine
* to do.
*/
for (i = 0; i < ARRAY_SIZE(types); i++) {
if (git_object__from_raw(&object, (const char *) data, size, types[i]) < 0)
continue;
git_object_free(object);
object = NULL;
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment