json5format initial integration (#5354)

* json5format initial integration

* Updated the dockerfile for json5format.
This commit is contained in:
DavidKorczynski 2021-03-13 04:40:33 +00:00 committed by GitHub
parent d108b02e95
commit a9240f097f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# Copyright 2021 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
RUN git clone --depth 1 https://github.com/google/json5format
WORKDIR $SRC
COPY build.sh $SRC/
COPY fuzz $SRC/json5format/fuzz

22
projects/json5format/build.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash -eu
# Copyright 2021 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.
#
################################################################################
cd $SRC/json5format
cargo fuzz build -O
ls -la ./fuzz
ls -la ./fuzz/target
cp ./fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_parse $OUT/fuzz_parse

4
projects/json5format/fuzz/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
target
corpus
artifacts

View File

@ -0,0 +1,24 @@
[package]
name = "json5format-fuzz"
version = "0.0.0"
authors = ["David Korczynski <david@adalogics.com>"]
publish = false
edition = "2018"
[package.metadata]
cargo-fuzz = true
[dependencies]
libfuzzer-sys = "0.3"
[dependencies.json5format]
path = ".."
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "fuzz_parse"
path = "fuzz_targets/fuzz_parse.rs"

View File

@ -0,0 +1,10 @@
#![no_main]
use libfuzzer_sys::fuzz_target;
use json5format::*;
use std::str;
fuzz_target!(|data: &[u8]| {
if let Ok(utf8) = str::from_utf8(data) {
ParsedDocument::from_str(utf8, None);
}
});

View File

@ -0,0 +1,10 @@
homepage: "https://crates.io/crates/json5format"
main_repo: "https://github.com/google/json5format"
primary_contact: "richkadel@google.com"
sanitizers:
- address
fuzzing_engines:
- libfuzzer
language: rust
auto_ccs:
- "david@adalogics.com"