diff --git a/projects/golang/Dockerfile b/projects/golang/Dockerfile index f7c31aa83..0f0db2243 100644 --- a/projects/golang/Dockerfile +++ b/projects/golang/Dockerfile @@ -36,6 +36,7 @@ COPY build.sh text_fuzzer.go \ elf_fuzzer.go \ tiff_fuzzer.go \ fuzz_tiff_decode.options \ - openpgp_fuzzer.go $SRC/ + openpgp_fuzzer.go \ + webp_fuzzer.go $SRC/ WORKDIR $SRC/golang diff --git a/projects/golang/build.sh b/projects/golang/build.sh index a1652e61a..34c7d1260 100755 --- a/projects/golang/build.sh +++ b/projects/golang/build.sh @@ -107,6 +107,11 @@ cd $SRC/instrumentation && go run main.go $SRC/crypto && cd - go mod tidy compile_go_fuzzer . FuzzOpenpgpRead fuzz_openpgp_read +cd $SRC/image/webp +cp $SRC/webp_fuzzer.go ./ +compile_go_fuzzer . FuzzWebpDecode fuzz_webp_decode +zip $OUT/fuzz_webp_decode_seed_corpus.zip $SRC/image/testdata/*.webp + cd $SRC/image/tiff cp $SRC/tiff_fuzzer.go ./ compile_go_fuzzer . FuzzTiffDecode fuzz_tiff_decode diff --git a/projects/golang/webp_fuzzer.go b/projects/golang/webp_fuzzer.go new file mode 100644 index 000000000..f1bc245b1 --- /dev/null +++ b/projects/golang/webp_fuzzer.go @@ -0,0 +1,25 @@ +// 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. +// + +package webp + +import ( + "bytes" +) + +func FuzzWebpDecode(data []byte) int { + _, _ = Decode(bytes.NewReader(data)) + return 1 +}