mirror of https://github.com/google/oss-fuzz.git
orjson: initial integration (#8147)
* orjson: initial integration * Changed to vendor_ccs * Removes add component step in Dockerfile * Remove blank line
This commit is contained in:
parent
ca20db082f
commit
f37532e7cb
|
@ -0,0 +1,29 @@
|
|||
# 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-python
|
||||
RUN apt-get update && apt-get install -y make autoconf automake libtool
|
||||
|
||||
RUN python3 -m pip install --upgrade pip
|
||||
|
||||
RUN rm -rf /usr/local/bin/cargo
|
||||
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2022-07-26 --profile minimal -y
|
||||
ENV PATH="/root/.cargo/bin:${PATH}"
|
||||
|
||||
RUN git clone --depth 1 https://github.com/ijl/orjson orjson
|
||||
|
||||
WORKDIR orjson
|
||||
COPY build.sh *.py $SRC/
|
|
@ -0,0 +1,23 @@
|
|||
#!/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.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
export RUSTFLAGS=""
|
||||
python3 -m pip install .
|
||||
|
||||
for fuzzer in $(find $SRC -name 'fuzz_*.py');do
|
||||
compile_python_fuzzer $fuzzer
|
||||
done
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/python3
|
||||
# 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.
|
||||
|
||||
import sys
|
||||
import atheris
|
||||
import orjson
|
||||
|
||||
|
||||
def TestOneInput(data):
|
||||
fdp = atheris.FuzzedDataProvider(data)
|
||||
original = fdp.ConsumeUnicode(sys.maxsize)
|
||||
|
||||
try:
|
||||
orjson_data = orjson.loads(original)
|
||||
except ValueError:
|
||||
return
|
||||
|
||||
encoded = orjson.dumps(orjson_data)
|
||||
del encoded
|
||||
|
||||
|
||||
def main():
|
||||
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
|
||||
atheris.instrument_all()
|
||||
atheris.Fuzz()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,11 @@
|
|||
homepage: "https://github.com/ijl/orjson"
|
||||
language: python
|
||||
fuzzing_engines:
|
||||
- libfuzzer
|
||||
sanitizers:
|
||||
- address
|
||||
- undefined
|
||||
main_repo: "https://github.com/ijl/orjson"
|
||||
vendor_ccs:
|
||||
- maxnair.dev@gmail.com
|
||||
file_github_issue: true
|
Loading…
Reference in New Issue