libprotobuf-mutator projects: fix builds (#7737)

* libprotobuf-mutator projects: fix builds

Ref: https://github.com/google/oss-fuzz/issues/7736

* boringssl: fix libprotobuf-mutator fuzzer

* giflib: fix libprotobuf-mutator fuzzer

* jsoncpp: fix libprotobuf-mutator fuzzer

* xerces-c: fix libprotobuf-mutator fuzzer

* libpng-proto: fix libprotobuf-mutator fuzzer

* giflib: add license header to satisfy CI
This commit is contained in:
DavidKorczynski 2022-05-21 13:34:16 +01:00 committed by GitHub
parent b76cac640c
commit 84d255ab00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 25 additions and 8 deletions

View File

@ -61,6 +61,7 @@ if [[ $CFLAGS != *sanitize=memory* ]]; then
fuzzerName=$(basename $fuzzerName .cc)
echo "Building fuzzer $fuzzerName"
$CXX $CXXFLAGS -I genfiles -I . -I $SRC/libprotobuf-mutator/ -I $SRC/LPM/external.protobuf/include -I include $LIB_FUZZING_ENGINE \
-DNDEBUG \
-I $SRC/boringssl/include \
$F genfiles/asn1_pdu.pb.cc $SRC/asn1_pdu_to_der.cc $SRC/common.cc \
./ssl/libssl.a ./crypto/libcrypto.a \

View File

@ -1,3 +1,19 @@
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
set -e
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)
@ -21,12 +37,12 @@ $CXX $CXXFLAGS $LIB_FUZZING_ENGINE -std=c++11 -I giflib-code egif_fuzz_common.c
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/ \
$CXX $CXXFLAGS -DNDEBUG -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 \
$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 \
ProtoToGif.cpp \
-I LPM/external.protobuf/include \
-I genfiles \

View File

@ -34,11 +34,11 @@ if [[ $CFLAGS != *sanitize=memory* ]]; then
rm -rf genfiles && mkdir genfiles && ../LPM/external.protobuf/bin/protoc json.proto --cpp_out=genfiles --proto_path=$SRC
# Compile LPM fuzzer.
$CXX $CXXFLAGS -I genfiles -I .. -I ../libprotobuf-mutator/ -I ../LPM/external.protobuf/include -I ../include $LIB_FUZZING_ENGINE \
$CXX $CXXFLAGS -DNDEBUG -I genfiles -I .. -I ../libprotobuf-mutator/ -I ../LPM/external.protobuf/include -I ../include $LIB_FUZZING_ENGINE \
$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 \
-o $OUT/jsoncpp_proto_fuzzer \
lib/libjsoncpp.a
fi
fi

View File

@ -32,7 +32,7 @@ rm -rf genfiles && mkdir genfiles && LPM/external.protobuf/bin/protoc png_fuzz_p
$CXX $CXXFLAGS -c -DLLVMFuzzerTestOneInput=FuzzPNG libpng/contrib/oss-fuzz/libpng_read_fuzzer.cc -I libpng
# compile & link the rest
$CXX $CXXFLAGS png_proto_fuzzer_example.cc libpng_read_fuzzer.o genfiles/png_fuzz_proto.pb.cc \
$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 \
LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \
@ -43,7 +43,7 @@ $CXX $CXXFLAGS png_proto_fuzzer_example.cc libpng_read_fuzzer.o genfiles/png_fuz
-o $OUT/png_proto_fuzzer_example
# custom png proto mutator
$CXX $CXXFLAGS png_proto_fuzzer_example.cc png_proto_mutator.cc libpng_read_fuzzer.o genfiles/png_fuzz_proto.pb.cc \
$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 \
LPM/src/libfuzzer/libprotobuf-mutator-libfuzzer.a \

View File

@ -22,7 +22,7 @@ objs/src/fuzz/wrappers.o:
\$(CC) $ngx_compile_opt \$(CFLAGS) -o objs/src/fuzz/wrappers.o src/fuzz/wrappers.c
objs/http_request_fuzzer: $ngx_deps_fuzz
\$(CXX) \$(CXXFLAGS) src/fuzz/http_request_fuzzer.cc \
\$(CXX) \$(CXXFLAGS) -DNDEBUG src/fuzz/http_request_fuzzer.cc \
src/fuzz/genfiles/http_request_proto.pb.cc \
-o objs/http_request_fuzzer \
\$(CORE_INCS) \$(HTTP_INCS) \

View File

@ -28,7 +28,7 @@ $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 -std=c++11 \
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE -DNDEBUG -std=c++11 \
-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 \