mirror of https://github.com/google/oss-fuzz.git
libdwarf: add seeds and cleanup fuzzers tt only used public headers (#6795)
This commit is contained in:
parent
baa79e1e6d
commit
4d4111183b
|
@ -17,6 +17,7 @@
|
||||||
FROM gcr.io/oss-fuzz-base/base-builder
|
FROM gcr.io/oss-fuzz-base/base-builder
|
||||||
RUN apt-get update && apt-get install -y make autoconf automake libtool
|
RUN apt-get update && apt-get install -y make autoconf automake libtool
|
||||||
RUN git clone --depth 1 https://github.com/davea42/libdwarf-code libdwarf
|
RUN git clone --depth 1 https://github.com/davea42/libdwarf-code libdwarf
|
||||||
|
RUN git clone --depth=1 https://github.com/DavidKorczynski/binary-samples $SRC/binary-samples
|
||||||
WORKDIR libdwarf
|
WORKDIR libdwarf
|
||||||
COPY build.sh $SRC/
|
COPY build.sh $SRC/
|
||||||
COPY fuzz*.c $SRC/
|
COPY fuzz*.c $SRC/
|
||||||
|
|
|
@ -15,14 +15,24 @@
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
export CFLAGS="${CFLAGS} -g"
|
export CFLAGS="${CFLAGS} -g -Werror"
|
||||||
export CXXFLAGS="${CXXFLAGS} -g"
|
export CXXFLAGS="${CXXFLAGS} -g -Werror"
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ../
|
cmake ../
|
||||||
make
|
make
|
||||||
|
|
||||||
|
# Build corpus for fuzzing
|
||||||
|
mkdir $SRC/corp
|
||||||
|
cp $SRC/binary-samples/elf* $SRC/corp
|
||||||
|
cp $SRC/binary-samples/Mach* $SRC/corp
|
||||||
|
cp $SRC/binary-samples/pe* $SRC/corp
|
||||||
|
cp $SRC/binary-samples/lib* $SRC/corp
|
||||||
|
|
||||||
|
zip -r -j $OUT/fuzz_init_path_seed_corpus.zip $SRC/corp
|
||||||
|
cp $OUT/fuzz_init_path_seed_corpus.zip $OUT/fuzz_init_binary_seed_corpus.zip
|
||||||
|
|
||||||
for fuzzName in init_path init_binary; do
|
for fuzzName in init_path init_binary; do
|
||||||
$CC $CFLAGS $LIB_FUZZING_ENGINE -I../src/lib/libdwarf/ \
|
$CC $CFLAGS $LIB_FUZZING_ENGINE -I../src/lib/libdwarf/ \
|
||||||
$SRC/fuzz_${fuzzName}.c -o $OUT/fuzz_${fuzzName} ./src/lib/libdwarf/libdwarf.a
|
$SRC/fuzz_${fuzzName}.c -o $OUT/fuzz_${fuzzName} ./src/lib/libdwarf/libdwarf.a
|
||||||
|
|
|
@ -18,11 +18,11 @@ limitations under the License.
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Libdwarf library callers can only use these headers.
|
||||||
|
*/
|
||||||
#include "dwarf.h"
|
#include "dwarf.h"
|
||||||
#include "libdwarf.h"
|
#include "libdwarf.h"
|
||||||
#include "libdwarf_private.h"
|
|
||||||
#include "dwarf_alloc.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A fuzzer that simulates a small part of the simplereader.c example.
|
* A fuzzer that simulates a small part of the simplereader.c example.
|
||||||
|
|
|
@ -16,11 +16,11 @@ limitations under the License.
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Libdwarf library callers can only use these headers.
|
||||||
|
*/
|
||||||
#include "dwarf.h"
|
#include "dwarf.h"
|
||||||
#include "libdwarf.h"
|
#include "libdwarf.h"
|
||||||
#include "libdwarf_private.h"
|
|
||||||
#include "dwarf_alloc.h"
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A fuzzer that simulates a small part of the simplereader.c example.
|
* A fuzzer that simulates a small part of the simplereader.c example.
|
||||||
|
|
Loading…
Reference in New Issue