From f1aba373a67e0de65e1644c43bd352eda4d9d34d Mon Sep 17 00:00:00 2001 From: manunio Date: Wed, 17 Aug 2022 19:20:06 +0530 Subject: [PATCH] burntsushi-toml: initial integration (#8279) --- projects/burntsushi-toml/Dockerfile | 22 ++++++++++++++++++++++ projects/burntsushi-toml/build.sh | 18 ++++++++++++++++++ projects/burntsushi-toml/fuzz.go | 20 ++++++++++++++++++++ projects/burntsushi-toml/project.yaml | 10 ++++++++++ 4 files changed, 70 insertions(+) create mode 100644 projects/burntsushi-toml/Dockerfile create mode 100755 projects/burntsushi-toml/build.sh create mode 100644 projects/burntsushi-toml/fuzz.go create mode 100644 projects/burntsushi-toml/project.yaml diff --git a/projects/burntsushi-toml/Dockerfile b/projects/burntsushi-toml/Dockerfile new file mode 100644 index 000000000..140803ec1 --- /dev/null +++ b/projects/burntsushi-toml/Dockerfile @@ -0,0 +1,22 @@ +# 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. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder-go +RUN apt-get update && apt-get install -y make autoconf automake libtool +RUN git clone --depth 1 https://github.com/BurntSushi/toml toml +COPY build.sh $SRC/ +COPY *.go $SRC/toml +WORKDIR $SRC/toml \ No newline at end of file diff --git a/projects/burntsushi-toml/build.sh b/projects/burntsushi-toml/build.sh new file mode 100755 index 000000000..9d8c5b8e6 --- /dev/null +++ b/projects/burntsushi-toml/build.sh @@ -0,0 +1,18 @@ +#!/bin/bash -eu +# 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. +# +################################################################################ + +compile_go_fuzzer . FuzzToml fuzz_toml gofuzz diff --git a/projects/burntsushi-toml/fuzz.go b/projects/burntsushi-toml/fuzz.go new file mode 100644 index 000000000..bc721c65a --- /dev/null +++ b/projects/burntsushi-toml/fuzz.go @@ -0,0 +1,20 @@ +package toml + +import "bytes" + +func FuzzToml(data []byte) int { + buf := make([]byte, 0, 2048) + + var m interface{} + _, err := Decode(string(data), &m) + if err != nil { + return 0 + } + + err = NewEncoder(bytes.NewBuffer(buf)).Encode(m) + if err != nil { + return 0 + } + + return 1 +} diff --git a/projects/burntsushi-toml/project.yaml b/projects/burntsushi-toml/project.yaml new file mode 100644 index 000000000..c7ee31d2f --- /dev/null +++ b/projects/burntsushi-toml/project.yaml @@ -0,0 +1,10 @@ +homepage: "https://github.com/BurntSushi/toml" +language: go +main_repo: "https://github.com/BurntSushi/toml" +fuzzing_engines: + - libfuzzer +sanitizers: + - address +vendor_ccs: + - maxnair.dev@gmail.com +file_github_issue: true