Skip to content

Commit

Permalink
[go-dns] Adds golang project dns (google#3474)
Browse files Browse the repository at this point in the history
* Adds golang project dns

* Fix auto_ccs syntax

* Rename project go-dns with hyphen
  • Loading branch information
catenacyber authored Mar 9, 2020
1 parent 0a6e93a commit 1cc1638
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
22 changes: 22 additions & 0 deletions projects/go-dns/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2020 Google Inc.
#
# 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.
#
################################################################################

FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER miek@miek.nl
RUN go get -t github.com/miekg/dns

COPY build.sh $SRC/
WORKDIR $SRC/
33 changes: 33 additions & 0 deletions projects/go-dns/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash -eu
# Copyright 2020 Google Inc.
#
# 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.
#
################################################################################

# build target function
function compile_fuzzer {
path=$1
function=$2
fuzzer=$3

# Instrument all Go files relevant to this fuzzer
go-fuzz-build -tags fuzz -libfuzzer -func $function -o $fuzzer.a $path

# Instrumented, compiled Go ($fuzzer.a) + fuzzing engine = fuzzer binary
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.a -lpthread -o $OUT/$fuzzer
}

#same as usual except for added -tags fuzz
compile_fuzzer /root/go/src/github.com/miekg/dns/ FuzzNewRR fuzz_newrr
compile_fuzzer /root/go/src/github.com/miekg/dns/ Fuzz fuzz_msg_unpack
9 changes: 9 additions & 0 deletions projects/go-dns/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
homepage: "https://github.com/miekg/dns"
primary_contact: "miek@miek.nl"
auto_ccs :
- "p.antoine@catenacyber.fr"
language: go
fuzzing_engines:
- libfuzzer
sanitizers:
- address

0 comments on commit 1cc1638

Please sign in to comment.