From abdc730160a93679673f12f6cb5076fc9f50a895 Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Fri, 27 Jan 2023 19:35:15 +0100 Subject: [PATCH] mdurl: initial integration (#9512) Signed-off-by: David Korczynski Signed-off-by: David Korczynski --- projects/mdurl/Dockerfile | 18 ++++++++++++++++++ projects/mdurl/build.sh | 22 ++++++++++++++++++++++ projects/mdurl/fuzz_mdurl.py | 34 ++++++++++++++++++++++++++++++++++ projects/mdurl/project.yaml | 10 ++++++++++ 4 files changed, 84 insertions(+) create mode 100644 projects/mdurl/Dockerfile create mode 100644 projects/mdurl/build.sh create mode 100644 projects/mdurl/fuzz_mdurl.py create mode 100644 projects/mdurl/project.yaml diff --git a/projects/mdurl/Dockerfile b/projects/mdurl/Dockerfile new file mode 100644 index 000000000..89ba704e6 --- /dev/null +++ b/projects/mdurl/Dockerfile @@ -0,0 +1,18 @@ +#!/usr/bin/python3 +# Copyright 2023 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 git clone https://github.com/executablebooks/mdurl mdurl +COPY *.sh *py $SRC/ +WORKDIR $SRC/mdurl diff --git a/projects/mdurl/build.sh b/projects/mdurl/build.sh new file mode 100644 index 000000000..0f26fbc3c --- /dev/null +++ b/projects/mdurl/build.sh @@ -0,0 +1,22 @@ +#!/bin/bash -eu +# Copyright 2023 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. +# +################################################################################ +pip3 install . + +# Build fuzzers in $OUT. +for fuzzer in $(find $SRC -name 'fuzz_*.py'); do + compile_python_fuzzer $fuzzer +done diff --git a/projects/mdurl/fuzz_mdurl.py b/projects/mdurl/fuzz_mdurl.py new file mode 100644 index 000000000..7da76fd95 --- /dev/null +++ b/projects/mdurl/fuzz_mdurl.py @@ -0,0 +1,34 @@ +#!/usr/bin/python3 +# Copyright 2023 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 mdurl + + +def TestOneInput(data): + fdp = atheris.FuzzedDataProvider(data) + mdurl.parse(fdp.ConsumeUnicodeNoSurrogates(sys.maxsize)) + mdurl.decode(fdp.ConsumeUnicodeNoSurrogates(sys.maxsize)) + mdurl.encode(fdp.ConsumeUnicodeNoSurrogates(sys.maxsize)) + + +def main(): + atheris.instrument_all() + atheris.Setup(sys.argv, TestOneInput) + atheris.Fuzz() + + +if __name__ == "__main__": + main() diff --git a/projects/mdurl/project.yaml b/projects/mdurl/project.yaml new file mode 100644 index 000000000..eb8d370e3 --- /dev/null +++ b/projects/mdurl/project.yaml @@ -0,0 +1,10 @@ +homepage: https://github.com/executablebooks/mdurl +main_repo: https://github.com/executablebooks/mdurl +language: python +fuzzing_engines: +- libfuzzer +sanitizers: +- address +- undefined +vendor_ccs: +- david@adalogics.com