Skip to content

Commit

Permalink
Fix libprotobuf-mutator fuzzers after google/libprotobuf-mutator/pull…
Browse files Browse the repository at this point in the history
…/220 (#10167)

Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
  • Loading branch information
vitalybuka and jonathanmetzman authored Apr 26, 2023
1 parent 963effb commit a455e65
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 16 deletions.
2 changes: 1 addition & 1 deletion projects/boringssl/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ if [[ $CFLAGS != *sanitize=memory* ]]; then
./ssl/libssl.a ./crypto/libcrypto.a \
$SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
$SRC/LPM/src/libprotobuf-mutator.a \
$SRC/LPM/external.protobuf/lib/libprotobuf.a \
-Wl,--start-group $SRC/LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
-o $OUT/"${fuzzerName}_lpm"
done
fi
7 changes: 6 additions & 1 deletion projects/cel-go/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ $SRC/LPM/external.protobuf/bin/protoc --go_out=fuzzlpm/ -I$SRC/ $SRC/cel-go-lpm.
cp fuzzlpm/github.com/google/cel-go/cel/*.pb.go cel/

$SRC/go114-fuzz-build/go114-fuzz-build -func FuzzEval -o fuzz_lpm.a github.com/google/cel-go/cel
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE cel-go-lpm.pb.o go-lpm.o fuzz_lpm.a $SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a $SRC/LPM/src/libprotobuf-mutator.a $SRC/LPM/external.protobuf/lib/libprotobuf.a -o $OUT/fuzz_lpm
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE cel-go-lpm.pb.o go-lpm.o \
fuzz_lpm.a \
$SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
$SRC/LPM/src/libprotobuf-mutator.a \
-Wl,--start-group $SRC/LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
-o $OUT/fuzz_lpm

compile_go_fuzzer github.com/google/cel-go/cel FuzzCompile fuzz_compile
4 changes: 2 additions & 2 deletions projects/giflib/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ $CXX $CXXFLAGS -DNDEBUG -Wall -c -I giflib-code dgif_protobuf_target.cc -I libpr
-I LPM/external.protobuf/include \
-o dgif_protobuf_target.o

$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -DNDEBUG -std=c++11 -I. -I giflib-code dgif_protobuf_target.o dgif_fuzz_common.cc genfiles/gif_fuzz_proto.pb.cc \
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -DNDEBUG -std=c++14 -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 \
-Wl,--start-group LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
-o $OUT/dgif_protobuf_target giflib-code/libgif.a


Expand Down
2 changes: 1 addition & 1 deletion projects/jsoncpp/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ $CXX $CXXFLAGS -DNDEBUG -I genfiles -I .. -I ../libprotobuf-mutator/ -I ../LPM/e
$SRC/jsoncpp_fuzz_proto.cc genfiles/json.pb.cc $SRC/json_proto_converter.cc \
../LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
../LPM/src/libprotobuf-mutator.a \
../LPM/external.protobuf/lib/libprotobuf.a \
-Wl,--start-group ../LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
-o $OUT/jsoncpp_proto_fuzzer \
lib/libjsoncpp.a
fi
8 changes: 4 additions & 4 deletions projects/libpng-proto/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ $CXX $CXXFLAGS -c -DLLVMFuzzerTestOneInput=FuzzPNG libpng/contrib/oss-fuzz/libpn
# compile & link the rest
$CXX $CXXFLAGS -DNDEBUG png_proto_fuzzer_example.cc libpng_read_fuzzer.o genfiles/png_fuzz_proto.pb.cc \
-I genfiles -I. -I libprotobuf-mutator/ -I LPM/external.protobuf/include \
-lz \
-fuse-ld=lld -lz \
LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
LPM/src/libprotobuf-mutator.a \
LPM/external.protobuf/lib/libprotobuf.a \
LPM/external.protobuf/lib/lib*.a \
libpng/.libs/libpng16.a \
$LIB_FUZZING_ENGINE \
-o $OUT/png_proto_fuzzer_example

# custom png proto mutator
$CXX $CXXFLAGS -DNDEBUG png_proto_fuzzer_example.cc png_proto_mutator.cc libpng_read_fuzzer.o genfiles/png_fuzz_proto.pb.cc \
-I genfiles -I. -I libprotobuf-mutator/ -I LPM/external.protobuf/include \
-lz \
-fuse-ld=lld -lz \
LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
LPM/src/libprotobuf-mutator.a \
LPM/external.protobuf/lib/libprotobuf.a \
LPM/external.protobuf/lib/lib*.a \
libpng/.libs/libpng16.a \
$LIB_FUZZING_ENGINE \
-o $OUT/png_proto_fuzzer_example_custom_mutator
Expand Down
2 changes: 1 addition & 1 deletion projects/mruby/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if [[ $CFLAGS != *sanitize=memory* ]]; then
-I $SRC/mruby/include -lz -lm \
$SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
$SRC/LPM/src/libprotobuf-mutator.a \
$SRC/LPM/external.protobuf/lib/libprotobuf.a \
-Wl,--start-group $SRC/LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
$SRC/mruby/build/host/lib/libmruby.a \
$LIB_FUZZING_ENGINE \
-o $OUT/mruby_proto_fuzzer
Expand Down
2 changes: 1 addition & 1 deletion projects/nginx/make_fuzzers
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ objs/http_request_fuzzer: $ngx_deps_fuzz
-I \$(SRC)/LPM/external.protobuf/include \
\$(SRC)/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
\$(SRC)/LPM/src/libprotobuf-mutator.a \
\$(SRC)/LPM/external.protobuf/lib/libprotobuf.a \
-Wl,--start-group \$(SRC)/LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
$ngx_binexit$ngx_long_cont$ngx_objs \
\$(LIB_FUZZING_ENGINE) $ngx_libs$ngx_link$ngx_main_link -lcrypt
$ngx_long_end
Expand Down
7 changes: 6 additions & 1 deletion projects/ngolo-fuzzing-x/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ compile_package () {
)
$SRC/ngolo-fuzzing/go114-fuzz-build/go114-fuzz-build -func FuzzNG_valid -o fuzz_ng_$pkg_flat.a ./fuzz_ng_$pkg_flat

$CXX $CXXFLAGS $LIB_FUZZING_ENGINE fuzz_ng_$pkg_flat/ngolofuzz.pb.o fuzz_ng_$pkg_flat//ngolofuzz.o fuzz_ng_$pkg_flat.a $SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a $SRC/LPM/src/libprotobuf-mutator.a $SRC/LPM/external.protobuf/lib/libprotobuf.a -o $OUT/fuzz_ng_$pkg_flat
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE fuzz_ng_$pkg_flat/ngolofuzz.pb.o fuzz_ng_$pkg_flat//ngolofuzz.o \
fuzz_ng_$pkg_flat.a \
$SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
$SRC/LPM/src/libprotobuf-mutator.a \
-Wl,--start-group $SRC/LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
-o $OUT/fuzz_ng_$pkg_flat
rm fuzz_ng_$pkg_flat.a
fi
(
Expand Down
7 changes: 6 additions & 1 deletion projects/ngolo-fuzzing/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ compile_package () {
)
$SRC/ngolo-fuzzing/go114-fuzz-build/go114-fuzz-build -func FuzzNG_valid -o fuzz_ng_$pkg_flat.a ./fuzz_ng_$pkg_flat

$CXX $CXXFLAGS $LIB_FUZZING_ENGINE fuzz_ng_$pkg_flat/ngolofuzz.pb.o fuzz_ng_$pkg_flat//ngolofuzz.o fuzz_ng_$pkg_flat.a $SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a $SRC/LPM/src/libprotobuf-mutator.a $SRC/LPM/external.protobuf/lib/libprotobuf.a -o $OUT/fuzz_ng_$pkg_flat
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE fuzz_ng_$pkg_flat/ngolofuzz.pb.o fuzz_ng_$pkg_flat//ngolofuzz.o \
fuzz_ng_$pkg_flat.a \
$SRC/LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
$SRC/LPM/src/libprotobuf-mutator.a \
-Wl,--start-group $SRC/LPM/external.protobuf/lib/lib*.a -Wl,--end-group \
-o $OUT/fuzz_ng_$pkg_flat
rm fuzz_ng_$pkg_flat.a
fi
(
Expand Down
4 changes: 2 additions & 2 deletions projects/xerces-c/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ $CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 \
if [[ $CFLAGS != *sanitize=memory* ]]; then
rm -rf genfiles && mkdir genfiles && LPM/external.protobuf/bin/protoc xml.proto --cpp_out=genfiles

$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -DNDEBUG -std=c++11 \
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -DNDEBUG -std=c++14 \
-I. -I xerces-c/src -Ixerces-c/build/src genfiles/xml.pb.cc xmlProtoConverter.cpp xerces_fuzz_common.cpp parse_target_proto.cpp \
-I libprotobuf-mutator/ \
-I genfiles \
-I LPM/external.protobuf/include \
-o $OUT/parse_target_proto xerces-c/src/.libs/libxerces-c.a \
LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
LPM/src/libprotobuf-mutator.a \
LPM/external.protobuf/lib/libprotobuf.a
-Wl,--start-group LPM/external.protobuf/lib/lib*.a -Wl,--end-group
fi
1 change: 0 additions & 1 deletion projects/xerces-c/parse_target_proto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <iostream>

namespace {
protobuf_mutator::protobuf::LogSilencer log_silincer;
void ignore(void* ctx, const char* msg, ...) {}

template <class T, class D>
Expand Down

0 comments on commit a455e65

Please sign in to comment.