mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
fuzzer: Add custom logger that explicitely raises abort()
This commit is contained in:
parent
12ea11632b
commit
bb4aadf968
2 changed files with 29 additions and 0 deletions
|
@ -68,6 +68,20 @@ appsrc_configuration (GstDiscoverer *dc, GstElement *source, gpointer data)
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
custom_logger (const gchar *log_domain,
|
||||||
|
GLogLevelFlags log_level,
|
||||||
|
const gchar *message,
|
||||||
|
gpointer unused_data)
|
||||||
|
{
|
||||||
|
if (log_level & G_LOG_LEVEL_CRITICAL) {
|
||||||
|
g_printerr ("CRITICAL ERROR : %s\n", message);
|
||||||
|
g_abort();
|
||||||
|
} else if (log_level & G_LOG_LEVEL_WARNING) {
|
||||||
|
g_printerr ("WARNING : %s\n", message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int LLVMFuzzerTestOneInput(const guint8 *data, size_t size)
|
int LLVMFuzzerTestOneInput(const guint8 *data, size_t size)
|
||||||
{
|
{
|
||||||
GError *err = NULL;
|
GError *err = NULL;
|
||||||
|
@ -79,6 +93,7 @@ int LLVMFuzzerTestOneInput(const guint8 *data, size_t size)
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
/* We want critical warnings to assert so we can fix them */
|
/* We want critical warnings to assert so we can fix them */
|
||||||
g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
|
g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
|
||||||
|
g_log_set_default_handler (custom_logger, NULL);
|
||||||
|
|
||||||
/* Only initialize and register plugins once */
|
/* Only initialize and register plugins once */
|
||||||
gst_init (NULL, NULL);
|
gst_init (NULL, NULL);
|
||||||
|
|
|
@ -41,6 +41,19 @@ GST_PLUGIN_STATIC_DECLARE (app);
|
||||||
* The goal is to cover typefind code and implementation.
|
* The goal is to cover typefind code and implementation.
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
static void
|
||||||
|
custom_logger (const gchar *log_domain,
|
||||||
|
GLogLevelFlags log_level,
|
||||||
|
const gchar *message,
|
||||||
|
gpointer unused_data)
|
||||||
|
{
|
||||||
|
if (log_level & G_LOG_LEVEL_CRITICAL) {
|
||||||
|
g_printerr ("CRITICAL ERROR : %s\n", message);
|
||||||
|
g_abort();
|
||||||
|
} else if (log_level & G_LOG_LEVEL_WARNING) {
|
||||||
|
g_printerr ("WARNING : %s\n", message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
|
LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
|
||||||
|
@ -55,6 +68,7 @@ LLVMFuzzerTestOneInput (const guint8 * data, size_t size)
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
/* We want critical warnings to assert so we can fix them */
|
/* We want critical warnings to assert so we can fix them */
|
||||||
g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
|
g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
|
||||||
|
g_log_set_default_handler (custom_logger, NULL);
|
||||||
|
|
||||||
/* Only initialize and register plugins once */
|
/* Only initialize and register plugins once */
|
||||||
gst_init (NULL, NULL);
|
gst_init (NULL, NULL);
|
||||||
|
|
Loading…
Reference in a new issue