-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Quickstart (requires Clang 6 or later): $ export LIB_FUZZING_ENGINE=/path/to/fuzzing/library.a $ ./configure --enable-fuzz-testing $ make $ cd src/fuzz $ make fuzz_mdb $ ./fuzz_mdb Also add a new `mdb_open_buffer function` to facilitate in-memory fuzz-testing. This requires fmemopen, which may not be present on all systems. The internal API has been reworked to use file streams instead of file descriptors. This allows reading from memory and reading from files using a consistent API.
- Loading branch information
1 parent
8b40423
commit be888e0
Showing
12 changed files
with
194 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
EXTRA_PROGRAMS = fuzz_mdb | ||
|
||
# Force C++ linking for fuzz target | ||
nodist_EXTRA_fuzz_mdb_SOURCES = dummy.cxx | ||
fuzz_mdb_SOURCES = fuzz_mdb.c | ||
|
||
AM_CFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) -g | ||
AM_LDFLAGS = -static | ||
LDADD = ../libmdb/libmdb.la @LIB_FUZZING_ENGINE@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include "mdbtools.h" | ||
|
||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { | ||
MdbHandle *mdb = mdb_open_buffer((void *)Data, Size, MDB_NOFLAGS); | ||
if (mdb) { | ||
mdb_read_catalog(mdb, MDB_TABLE); | ||
for (int j=0; j<mdb->num_catalog; j++) { | ||
MdbCatalogEntry *entry = g_ptr_array_index (mdb->catalog, j); | ||
MdbTableDef *table = mdb_read_table(entry); | ||
if (table) { | ||
mdb_read_columns(table); | ||
mdb_rewind_table(table); | ||
while (mdb_fetch_row(table)); | ||
mdb_free_tabledef(table); | ||
} | ||
} | ||
mdb_close(mdb); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.