burntsushi-toml: initial integration (#8279)

This commit is contained in:
manunio 2022-08-17 19:20:06 +05:30 committed by GitHub
parent 20e8ba44b3
commit f1aba373a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 70 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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