Integrate oss-fuzz targets

This commit is contained in:
pdknsk
2018-10-11 00:02:03 +00:00
committed by Philip Withnall
parent 6c8b9f31b1
commit a2c09f57f6
13 changed files with 268 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
#include "fuzz.h"
const static GDBusCapabilityFlags flags = G_DBUS_CAPABILITY_FLAGS_UNIX_FD_PASSING;
int
LLVMFuzzerTestOneInput (const unsigned char *data, size_t size)
{
gssize bytes;
GDBusMessage *msg = NULL;
guchar *blob = NULL;
gsize msg_size;
fuzz_set_logging_func ();
bytes = g_dbus_message_bytes_needed ((guchar*) data, size, NULL);
if (bytes <= 0)
return 0;
msg = g_dbus_message_new_from_blob ((guchar*) data, size, flags, NULL);
if (msg == NULL)
return 0;
blob = g_dbus_message_to_blob (msg, &msg_size, flags, NULL);
g_free (blob);
g_object_unref (msg);
return 0;
}