mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Add theme_load to fe-fuzz
This commit is contained in:
parent
4512e2683a
commit
182673ed05
1
.gitignore
vendored
1
.gitignore
vendored
@ -33,6 +33,7 @@ docs/help/in/Makefile.am
|
|||||||
src/fe-text/irssi
|
src/fe-text/irssi
|
||||||
src/fe-fuzz/irssi-fuzz
|
src/fe-fuzz/irssi-fuzz
|
||||||
src/fe-fuzz/irc/core/event-get-params-fuzz
|
src/fe-fuzz/irc/core/event-get-params-fuzz
|
||||||
|
src/fe-fuzz/fe-common/core/theme-load-fuzz
|
||||||
|
|
||||||
src/fe-common/irc/irc-modules.c
|
src/fe-common/irc/irc-modules.c
|
||||||
src/irc/irc.c
|
src/irc/irc.c
|
||||||
|
@ -652,6 +652,8 @@ src/fe-common/irc/notifylist/Makefile
|
|||||||
src/fe-fuzz/Makefile
|
src/fe-fuzz/Makefile
|
||||||
src/fe-fuzz/irc/Makefile
|
src/fe-fuzz/irc/Makefile
|
||||||
src/fe-fuzz/irc/core/Makefile
|
src/fe-fuzz/irc/core/Makefile
|
||||||
|
src/fe-fuzz/fe-common/Makefile
|
||||||
|
src/fe-fuzz/fe-common/core/Makefile
|
||||||
src/fe-none/Makefile
|
src/fe-none/Makefile
|
||||||
src/fe-text/Makefile
|
src/fe-text/Makefile
|
||||||
src/lib-config/Makefile
|
src/lib-config/Makefile
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
SUBDIRS = irc
|
SUBDIRS = irc fe-common
|
||||||
|
|
||||||
bin_PROGRAMS = irssi-fuzz
|
bin_PROGRAMS = irssi-fuzz
|
||||||
|
|
||||||
|
1
src/fe-fuzz/fe-common/Makefile.am
Normal file
1
src/fe-fuzz/fe-common/Makefile.am
Normal file
@ -0,0 +1 @@
|
|||||||
|
SUBDIRS = core
|
46
src/fe-fuzz/fe-common/core/Makefile.am
Normal file
46
src/fe-fuzz/fe-common/core/Makefile.am
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
bin_PROGRAMS = theme-load-fuzz
|
||||||
|
|
||||||
|
# Force link with CXX for libfuzzer support
|
||||||
|
CCLD=$(CXX) $(CXXFLAGS)
|
||||||
|
|
||||||
|
AM_CPPFLAGS = \
|
||||||
|
-I$(top_srcdir)/src \
|
||||||
|
-I$(top_srcdir)/src/core/ \
|
||||||
|
-I$(top_srcdir)/src/irc/core/ \
|
||||||
|
-I$(top_srcdir)/src/fe-common/core/ \
|
||||||
|
$(GLIB_CFLAGS)
|
||||||
|
|
||||||
|
AM_DEPENDENCIES = \
|
||||||
|
../../../core/libcore.a \
|
||||||
|
../../../lib-config/libirssi_config.a \
|
||||||
|
../../../irc/libirc.a \
|
||||||
|
../../../irc/core/libirc_core.a \
|
||||||
|
../../../irc/dcc/libirc_dcc.a \
|
||||||
|
../../../irc/flood/libirc_flood.a \
|
||||||
|
../../../irc/notifylist/libirc_notifylist.a \
|
||||||
|
../../../fe-common/core/libfe_common_core.a \
|
||||||
|
../../../fe-common/irc/libfe_common_irc.a \
|
||||||
|
../../../fe-common/irc/dcc/libfe_irc_dcc.a \
|
||||||
|
../../../fe-common/irc/notifylist/libfe_irc_notifylist.a
|
||||||
|
|
||||||
|
LDADD = \
|
||||||
|
../../../irc/libirc.a \
|
||||||
|
../../../irc/core/libirc_core.a \
|
||||||
|
../../../irc/dcc/libirc_dcc.a \
|
||||||
|
../../../irc/flood/libirc_flood.a \
|
||||||
|
../../../irc/notifylist/libirc_notifylist.a \
|
||||||
|
../../../fe-common/core/libfe_common_core.a \
|
||||||
|
../../../fe-common/irc/libfe_common_irc.a \
|
||||||
|
../../../fe-common/irc/dcc/libfe_irc_dcc.a \
|
||||||
|
../../../fe-common/irc/notifylist/libfe_irc_notifylist.a \
|
||||||
|
../../../core/libcore.a \
|
||||||
|
../../../lib-config/libirssi_config.a \
|
||||||
|
@PROG_LIBS@ \
|
||||||
|
$(FUZZER_LIBS)
|
||||||
|
|
||||||
|
theme_load_fuzz_SOURCES = \
|
||||||
|
theme-load.c \
|
||||||
|
$(top_srcdir)/src/fe-text/module-formats.c
|
||||||
|
|
||||||
|
noinst_HEADERS = \
|
||||||
|
$(top_srcdir)/src/fe-text/module-formats.h
|
66
src/fe-fuzz/fe-common/core/theme-load.c
Normal file
66
src/fe-fuzz/fe-common/core/theme-load.c
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
theme-load.c : irssi
|
||||||
|
|
||||||
|
Copyright (C) 2018 Joseph Bisch
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "module.h"
|
||||||
|
#include "modules-load.h"
|
||||||
|
#include "levels.h"
|
||||||
|
#include "../fe-text/module-formats.h" // need to explicitly grab from fe-text
|
||||||
|
#include "themes.h"
|
||||||
|
#include "core.h"
|
||||||
|
#include "fe-common-core.h"
|
||||||
|
#include "args.h"
|
||||||
|
#include "printtext.h"
|
||||||
|
#include "irc.h"
|
||||||
|
#include "themes.h"
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#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;
|
||||||
|
args_execute(irssi_argc, irssi_argv);
|
||||||
|
core_preinit((*argv)[0]);
|
||||||
|
core_init();
|
||||||
|
fe_common_core_init();
|
||||||
|
theme_register(gui_text_formats);
|
||||||
|
module_register("core", "fe-fuzz");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
|
gchar *copy = g_strndup((const gchar *)data, size);
|
||||||
|
|
||||||
|
FILE *fp = fopen("/tmp/irssi/fuzz.theme", "wb");
|
||||||
|
if (fp) {
|
||||||
|
fwrite(copy, strlen(copy), 1, fp);
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
THEME_REC *theme = theme_load("fuzz");
|
||||||
|
theme_destroy(theme);
|
||||||
|
|
||||||
|
g_free(copy);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user