fuzzing: Compilation fixes

This commit is contained in:
Edward Hervey 2017-10-31 08:03:48 +01:00 committed by Edward Hervey
parent 87e1f69b19
commit 80d8fcec0c

View file

@ -42,22 +42,15 @@ GST_PLUGIN_STATIC_DECLARE(app);
*
**/
static void
appsrc_configuration (GstDiscoverer *dc, GstElement *source, gpointer data)
{
GstBuffer *buf;
GstFlowReturn ret;
/* Create buffer from fuzztesting_data which shouldn't be freed */
}
int LLVMFuzzerTestOneInput(const guint8 *data, size_t size)
int
LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
{
GError *err = NULL;
static gboolean initialized = 0;
GstElement *pipeline, *source, *typefind, *fakesink;
GstBuffer *buf;
GstFlowReturn flowret;
GstState state;
if (!initialized) {
/* We want critical warnings to assert so we can fix them
@ -85,14 +78,14 @@ int LLVMFuzzerTestOneInput(const guint8 *data, size_t size)
buf = gst_buffer_new_wrapped_full (0, (gpointer) data, size,
0, size, NULL, NULL);
g_object_set (G_OBJECT (source), "size", size, NULL);
g_signal_emit_by_name (G_OBJECT(source), "push-buffer", buf, &ret);
g_signal_emit_by_name (G_OBJECT (source), "push-buffer", buf, &flowret);
gst_buffer_unref (buf);
/* Set pipeline to PAUSED and wait (typefind will either fail or succeed) */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PAUSED);
/* wait until state change either completes or fails */
sret = gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, -1);
gst_element_get_state (GST_ELEMENT (pipeline), &state, NULL, -1);
/* Go back to NULL */
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_NULL);
@ -102,4 +95,3 @@ int LLVMFuzzerTestOneInput(const guint8 *data, size_t size)
return 0;
}