1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-16 06:25:24 +00:00

silence glib log output during fuzzing on oss-fuzz

This commit is contained in:
ailin-nemui 2019-09-10 13:08:35 +02:00
parent 96562e460b
commit 9ff224d05d
12 changed files with 48 additions and 0 deletions

View File

@ -17,6 +17,7 @@ irssi_fuzz_LDADD = \
irssi_fuzz_SOURCES = \
irssi.c \
null-logger.c \
../fe-text/module-formats.c
server_fuzz_DEPENDENCIES = @COMMON_LIBS@
@ -28,7 +29,9 @@ server_fuzz_LDADD = \
server_fuzz_SOURCES = \
server.c \
null-logger.c \
../fe-text/module-formats.c
noinst_HEADERS = \
null-logger.h \
../fe-text/module-formats.h

View File

@ -22,6 +22,7 @@ LDADD = \
$(FUZZER_LIBS)
theme_load_fuzz_SOURCES = \
../../null-logger.c \
theme-load.c \
$(top_srcdir)/src/fe-text/module-formats.c

View File

@ -1,6 +1,7 @@
# this file is part of irssi
executable('theme-load-fuzz',
files(
'../../null-logger.c',
'theme-load.c',
'../../../fe-text/module-formats.c',
),

View File

@ -29,6 +29,7 @@
#include <irssi/src/fe-common/core/printtext.h>
#include <irssi/src/irc/core/irc.h>
#include <irssi/src/fe-common/core/themes.h>
#include <irssi/src/fe-fuzz/null-logger.h>
#include <stddef.h>
#include <stdint.h>
@ -38,6 +39,9 @@
int LLVMFuzzerInitialize(int *argc, char ***argv) {
char *irssi_argv[] = {*argv[0], "--home", "/tmp/irssi", NULL};
int irssi_argc = sizeof(irssi_argv) / sizeof(char *) - 1;
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
g_log_set_null_logger();
#endif
core_register_options();
fe_common_core_register_options();
args_execute(irssi_argc, irssi_argv);

View File

@ -22,6 +22,7 @@ LDADD = \
$(FUZZER_LIBS)
event_get_params_fuzz_SOURCES = \
../../null-logger.c \
event-get-params.c \
$(top_srcdir)/src/fe-text/module-formats.c

View File

@ -28,6 +28,7 @@
#include <irssi/src/core/args.h>
#include <irssi/src/fe-common/core/printtext.h>
#include <irssi/src/irc/core/irc.h>
#include <irssi/src/fe-fuzz/null-logger.h>
#include <stddef.h>
#include <stdint.h>
@ -35,6 +36,9 @@
#include <string.h>
int LLVMFuzzerInitialize(int *argc, char ***argv) {
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
g_log_set_null_logger();
#endif
core_register_options();
fe_common_core_register_options();
/* no args */

View File

@ -2,6 +2,7 @@
executable('event-get-params-fuzz',
files(
'../../null-logger.c',
'event-get-params.c',
'../../../fe-text/module-formats.c',
),

View File

@ -27,6 +27,7 @@
#include <irssi/src/fe-common/core/fe-common-core.h>
#include <irssi/src/core/args.h>
#include <irssi/src/fe-common/core/printtext.h>
#include <irssi/src/fe-fuzz/null-logger.h>
#include <stddef.h>
#include <stdint.h>
@ -34,6 +35,9 @@
#include <string.h>
int LLVMFuzzerInitialize(int *argc, char ***argv) {
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
g_log_set_null_logger();
#endif
core_register_options();
fe_common_core_register_options();
/* no args */

View File

@ -5,6 +5,7 @@ subdir('fe-common')
executable('irssi-fuzz',
files(
'null-logger.c',
'irssi.c',
'../fe-text/module-formats.c',
),
@ -23,6 +24,7 @@ executable('irssi-fuzz',
executable('server-fuzz',
files(
'null-logger.c',
'server.c',
'../fe-text/module-formats.c',
),
@ -44,5 +46,6 @@ executable('server-fuzz',
)
# noinst_headers = files(
# 'null-logger.h',
# '../fe-text/module-formats.h',
# )

16
src/fe-fuzz/null-logger.c Normal file
View File

@ -0,0 +1,16 @@
#include <irssi/src/fe-fuzz/null-logger.h>
#include <glib.h>
static void null_logger(const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer user_data)
{
return;
}
void g_log_set_null_logger(void)
{
g_log_set_default_handler(null_logger, NULL);
}

View File

@ -0,0 +1,6 @@
#ifndef IRSSI_FE_FUZZ_NULL_LOGGER_H
#define IRSSI_FE_FUZZ_NULL_LOGGER_H
void g_log_set_null_logger(void);
#endif

View File

@ -41,6 +41,7 @@
#include <irssi/src/irc/core/irc.h>
#include <irssi/src/irc/core/irc-servers.h>
#include <irssi/src/irc/core/irc-channels.h>
#include <irssi/src/fe-fuzz/null-logger.h>
/* irc.c */
void irc_init(void);
@ -143,6 +144,9 @@ void test_server() {
}
int LLVMFuzzerInitialize(int *argc, char ***argv) {
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
g_log_set_null_logger();
#endif
core_register_options();
fe_common_core_register_options();
/* no args */