meson build support

This commit is contained in:
Ailin Nemui 2019-07-08 00:02:53 +02:00
commit db16a0a853
57 changed files with 1787 additions and 46 deletions

View file

@ -0,0 +1,21 @@
# this file is part of irssi
executable('theme-load-fuzz',
files(
'theme-load.c',
'../../../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libfuzzer_fe_common_core_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
# noinst_headers = files(
# '../../../fe-text/module-formats.h',
# )

View file

@ -36,10 +36,10 @@
#include <string.h>
int LLVMFuzzerInitialize(int *argc, char ***argv) {
core_register_options();
fe_common_core_register_options();
char *irssi_argv[] = {*argv[0], "--home", "/tmp/irssi", NULL};
int irssi_argc = sizeof(irssi_argv) / sizeof(char *) - 1;
core_register_options();
fe_common_core_register_options();
args_execute(irssi_argc, irssi_argv);
core_preinit((*argv)[0]);
core_init();
@ -50,6 +50,7 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
}
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
THEME_REC *theme;
gchar *copy = g_strndup((const gchar *)data, size);
FILE *fp = fopen("/tmp/irssi/fuzz.theme", "wb");
@ -58,7 +59,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
fclose(fp);
}
THEME_REC *theme = theme_load("fuzz");
theme = theme_load("fuzz");
theme_destroy(theme);
g_free(copy);

View file

@ -0,0 +1,3 @@
# this file is part of irssi
subdir('core')

View file

@ -48,17 +48,21 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
}
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 1) {
return 0;
}
uint8_t count = *data;
gchar *copy = g_strndup((const gchar *)data+1, size-1);
gchar *copy;
char *output0;
char *output1;
char *output2;
char *output3;
char *params;
if (size < 1) {
return 0;
}
copy = g_strndup((const gchar *)data+1, size-1);
if (count % 8 == 0) {
params = event_get_params(copy, 1 | PARAM_FLAG_GETREST, &output0);
} else if (count % 8 == 1) {

View file

@ -0,0 +1,23 @@
# this file is part of irssi
executable('event-get-params-fuzz',
files(
'event-get-params.c',
'../../../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libirc_a,
libfuzzer_fe_common_core_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
# noinst_headers = files(
# '../../../fe-text/module-formats.h',
# )

View file

@ -0,0 +1,3 @@
# this file is part of irssi
subdir('core')

46
src/fe-fuzz/meson.build Normal file
View file

@ -0,0 +1,46 @@
# this file is part of irssi
subdir('irc')
subdir('fe-common')
executable('irssi-fuzz',
files(
'irssi.c',
'../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libfuzzer_fe_common_core_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
executable('server-fuzz',
files(
'server.c',
'../fe-text/module-formats.c',
),
link_with : [
libconfig_a,
libcore_a,
libfuzzer_fe_common_core_a,
libirc_a,
libfe_common_irc_a,
libfe_irc_dcc_a,
libfe_irc_notifylist_a,
],
link_args : [fuzzer_lib],
include_directories : rootinc,
implicit_include_directories : false,
install : true,
dependencies : dep
)
# noinst_headers = files(
# '../fe-text/module-formats.h',
# )

View file

@ -150,13 +150,18 @@ int LLVMFuzzerInitialize(int *argc, char ***argv) {
}
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
gboolean prefixedChoice = (gboolean)*data;
gchar *copy;
gchar **lines;
gchar **head;
if (size < 1) return 0;
test_server();
gboolean prefixedChoice = (gboolean)*data;
gchar *copy = g_strndup((const gchar *)data+1, size-1);
gchar **lines = g_strsplit(copy, "\r\n", -1);
gchar **head = lines;
copy = g_strndup((const gchar *)data+1, size-1);
lines = g_strsplit(copy, "\r\n", -1);
head = lines;
for (; *lines != NULL; lines++) {
gchar *prefixedLine;