From eb7e7729533c188cd0691b4fd01cc5750351712c Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Thu, 18 Aug 2022 01:10:33 +0100 Subject: [PATCH] charset_normalizer: initial integration (#8265) * charset_normalizer: initial integration * add primary contact --- projects/charset_normalizer/Dockerfile | 21 +++++++++++ projects/charset_normalizer/build.sh | 21 +++++++++++ projects/charset_normalizer/fuzz_normalize.py | 36 +++++++++++++++++++ projects/charset_normalizer/project.yaml | 12 +++++++ 4 files changed, 90 insertions(+) create mode 100644 projects/charset_normalizer/Dockerfile create mode 100755 projects/charset_normalizer/build.sh create mode 100644 projects/charset_normalizer/fuzz_normalize.py create mode 100644 projects/charset_normalizer/project.yaml diff --git a/projects/charset_normalizer/Dockerfile b/projects/charset_normalizer/Dockerfile new file mode 100644 index 000000000..9fedacc09 --- /dev/null +++ b/projects/charset_normalizer/Dockerfile @@ -0,0 +1,21 @@ +# 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 git clone --depth 1 https://github.com/Ousret/charset_normalizer charset_normalizer +WORKDIR charset_normalizer +COPY build.sh *.py $SRC/ diff --git a/projects/charset_normalizer/build.sh b/projects/charset_normalizer/build.sh new file mode 100755 index 000000000..1974eb7eb --- /dev/null +++ b/projects/charset_normalizer/build.sh @@ -0,0 +1,21 @@ +#!/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. +# +################################################################################ + +pip3 install . +for fuzzer in $(find $SRC -name 'fuzz_*.py'); do + compile_python_fuzzer $fuzzer +done diff --git a/projects/charset_normalizer/fuzz_normalize.py b/projects/charset_normalizer/fuzz_normalize.py new file mode 100644 index 000000000..24032fe4f --- /dev/null +++ b/projects/charset_normalizer/fuzz_normalize.py @@ -0,0 +1,36 @@ +#!/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 os +import sys +import atheris + +from charset_normalizer import from_bytes + + +def TestOneInput(data): + """Simply pass fuzz data directly into charset_normaliser""" + # No exceptions thrown + from_bytes(data) + + +def main(): + atheris.instrument_all() + atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) + atheris.Fuzz() + + +if __name__ == "__main__": + main() diff --git a/projects/charset_normalizer/project.yaml b/projects/charset_normalizer/project.yaml new file mode 100644 index 000000000..5565c5052 --- /dev/null +++ b/projects/charset_normalizer/project.yaml @@ -0,0 +1,12 @@ +homepage: "https://github.com/Ousret/charset_normalizer" +language: python +primary_contact: "ahmed.tahri@cloudnursery.dev" +main_repo: "https://github.com/Ousret/charset_normalizer" +fuzzing_engines: +- libfuzzer +sanitizers: +- address +- undefined +vendor_ccs: +- david@adalogics.com +- adam@adalogics.com