Skip to content

Commit

Permalink
Add fuzzer for the terminal
Browse files Browse the repository at this point in the history
This commit adds a fuzzer for more of the terminal pipeline, adding
coverage for the input and output portions of the terminal
framebuffer.
  • Loading branch information
achernya committed May 31, 2022
1 parent 4282c63 commit f2ad6fe
Show file tree
Hide file tree
Showing 18 changed files with 33 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/fuzz/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
AM_CXXFLAGS = $(WARNING_CXXFLAGS) $(PICKY_CXXFLAGS) $(HARDEN_CFLAGS) $(MISC_CXXFLAGS) $(CODE_COVERAGE_CXXFLAGS) $(FUZZING_CFLAGS)

noinst_PROGRAMS = terminal_parser_fuzzer
noinst_PROGRAMS = terminal_parser_fuzzer terminal_fuzzer

terminal_parser_fuzzer_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util
terminal_parser_fuzzer_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a
terminal_parser_fuzzer_SOURCES = terminal_parser_fuzzer.cc

terminal_fuzzer_CPPFLAGS = -I$(srcdir)/../terminal -I$(srcdir)/../util -I$(srcdir)/../statesync -I../protobufs
terminal_fuzzer_LDADD = ../terminal/libmoshterminal.a ../util/libmoshutil.a ../statesync/libmoshstatesync.a ../protobufs/libmoshprotos.a $(TINFO_LIBS) $(protobuf_LIBS)
terminal_fuzzer_SOURCES = terminal_fuzzer.cc
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
&�����:#
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
&
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@


@
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

@
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
17 changes: 17 additions & 0 deletions src/fuzz/terminal_fuzzer.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <cstddef>
#include <cstdint>

#include "parser.h"
#include "completeterminal.h"

extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
Terminal::Display display(false);
Terminal::Complete complete(80, 24);
Terminal::Framebuffer state(80, 24);
for (size_t i = 0; i < size; i++) {
complete.act(Parser::UserByte(data[i]));
}
display.new_frame(true, state, complete.get_fb());

return 0;
}

0 comments on commit f2ad6fe

Please sign in to comment.