2019-05-24 12:17:06 +00:00
|
|
|
set -e
|
2019-02-15 22:07:49 +00:00
|
|
|
SOURCES=(dgif_lib.c egif_lib.c getarg.c gifalloc.c gif_err.c gif_font.c \
|
|
|
|
gif_hash.c openbsd-reallocarray.c qprintf.c quantize.c)
|
2019-01-08 19:17:29 +00:00
|
|
|
cd $SRC/giflib-code
|
2019-02-15 22:07:49 +00:00
|
|
|
rm -f *.o
|
|
|
|
for file in ${SOURCES[@]};
|
2019-01-08 19:17:29 +00:00
|
|
|
do
|
|
|
|
name=$(basename $file .c)
|
2019-02-15 22:07:49 +00:00
|
|
|
$CC -c -I . $CFLAGS $file -o $name.o
|
2019-01-08 19:17:29 +00:00
|
|
|
done
|
2019-02-15 22:07:49 +00:00
|
|
|
ar rc libgif.a *.o
|
|
|
|
|
|
|
|
cd $SRC
|
2019-05-24 12:17:06 +00:00
|
|
|
$CXX $CFLAGS -Wall -c -I giflib-code dgif_target.cc -o dgif_target.o
|
|
|
|
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 -I giflib-code dgif_fuzz_common.cc dgif_target.o \
|
|
|
|
-o $OUT/dgif_target giflib-code/libgif.a
|
|
|
|
|
|
|
|
$CXX $CXXFLAGS -Wall -c -I giflib-code egif_target.cc -o egif_target.o
|
|
|
|
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 -I giflib-code egif_fuzz_common.cc egif_target.o \
|
|
|
|
-o $OUT/egif_target giflib-code/libgif.a
|
|
|
|
|
|
|
|
rm -rf genfiles && mkdir genfiles && LPM/external.protobuf/bin/protoc gif_fuzz_proto.proto --cpp_out=genfiles
|
|
|
|
|
|
|
|
$CXX $CXXFLAGS -Wall -c -I giflib-code dgif_protobuf_target.cc -I libprotobuf-mutator/ \
|
|
|
|
-I genfiles \
|
|
|
|
-I LPM/external.protobuf/include \
|
|
|
|
-o dgif_protobuf_target.o
|
|
|
|
|
|
|
|
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 -I. -I giflib-code dgif_protobuf_target.o dgif_fuzz_common.cc genfiles/gif_fuzz_proto.pb.cc \
|
|
|
|
ProtoToGif.cpp \
|
|
|
|
-I LPM/external.protobuf/include \
|
|
|
|
-I genfiles \
|
|
|
|
LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
|
|
|
|
LPM/src/libprotobuf-mutator.a \
|
|
|
|
LPM/external.protobuf/lib/libprotobuf.a \
|
|
|
|
-o $OUT/dgif_protobuf_target giflib-code/libgif.a
|
|
|
|
|
2019-02-15 22:07:49 +00:00
|
|
|
|
2019-01-08 19:17:29 +00:00
|
|
|
# Place dict and config in OUT
|
|
|
|
wget -O $OUT/gif.dict \
|
|
|
|
https://raw.githubusercontent.com/mirrorer/afl/master/dictionaries/gif.dict \
|
|
|
|
&> /dev/null
|
|
|
|
cp $SRC/*.options $OUT/
|
|
|
|
find $SRC/giflib-code -iname "*.gif" -exec \
|
|
|
|
zip -ujq $OUT/dgif_target_seed_corpus.zip "{}" \;
|