From 9cf0f778411887b04e2312bd8f5506a1323d07a0 Mon Sep 17 00:00:00 2001 From: Arthur Chan Date: Tue, 18 Jul 2023 01:28:55 +0100 Subject: [PATCH] evo-inflector: Initial integration (#10700) Initial integration for evo-inflector. Signed-off-by: Arthur Chan --- projects/evo-inflector/Dockerfile | 24 +++++++++ projects/evo-inflector/EnglishFuzzer.java | 39 ++++++++++++++ projects/evo-inflector/build.sh | 62 +++++++++++++++++++++++ projects/evo-inflector/project.yaml | 11 ++++ 4 files changed, 136 insertions(+) create mode 100644 projects/evo-inflector/Dockerfile create mode 100644 projects/evo-inflector/EnglishFuzzer.java create mode 100644 projects/evo-inflector/build.sh create mode 100644 projects/evo-inflector/project.yaml diff --git a/projects/evo-inflector/Dockerfile b/projects/evo-inflector/Dockerfile new file mode 100644 index 000000000..f366332a3 --- /dev/null +++ b/projects/evo-inflector/Dockerfile @@ -0,0 +1,24 @@ +# 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-jvm +RUN curl -L https://archive.apache.org/dist/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.zip \ + -o maven.zip && \ + unzip maven.zip -d $SRC/maven && \ + rm maven.zip +ENV MVN $SRC/maven/apache-maven-3.6.3/bin/mvn +RUN git clone --depth 1 https://github.com/atteo/evo-inflector evo-inflector +COPY *.sh *.java $SRC/ +WORKDIR $SRC/evo-inflector diff --git a/projects/evo-inflector/EnglishFuzzer.java b/projects/evo-inflector/EnglishFuzzer.java new file mode 100644 index 000000000..bf614d06f --- /dev/null +++ b/projects/evo-inflector/EnglishFuzzer.java @@ -0,0 +1,39 @@ +// 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 com.code_intelligence.jazzer.api.FuzzedDataProvider; +import org.atteo.evo.inflector.English; + +// Generated with https://github.com/ossf/fuzz-introspector/tree/main/tools/auto-fuzz +// Minor modifications to beautify code and ensure exception is caught. +// jvm-autofuzz-heuristics-1 +// Heuristic name: jvm-autofuzz-heuristics-1 +// Target method: [org.atteo.evo.inflector.English] public static java.lang.String +// plural(java.lang.String) +public class EnglishFuzzer { + private static English.MODE[] mode = { + English.MODE.ENGLISH_ANGLICIZED, English.MODE.ENGLISH_CLASSICAL}; + + public static void fuzzerTestOneInput(FuzzedDataProvider data) { + English.setMode(data.pickValue(mode)); + Boolean choice = data.consumeBoolean(); + if (choice) { + English.plural(data.consumeRemainingAsString()); + } else { + Integer int1 = data.consumeInt(); + English.plural(data.consumeRemainingAsString(), int1); + } + } +} diff --git a/projects/evo-inflector/build.sh b/projects/evo-inflector/build.sh new file mode 100644 index 000000000..98f0cf7f6 --- /dev/null +++ b/projects/evo-inflector/build.sh @@ -0,0 +1,62 @@ +#!/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. +# +########################################################################## +find ./ -name pom.xml -exec sed -i 's/source>1.61.81.61.8 $OUT/$fuzzer_basename + + chmod u+x $OUT/$fuzzer_basename +done diff --git a/projects/evo-inflector/project.yaml b/projects/evo-inflector/project.yaml new file mode 100644 index 000000000..1c7a62f32 --- /dev/null +++ b/projects/evo-inflector/project.yaml @@ -0,0 +1,11 @@ +homepage: https://github.com/atteo/evo-inflector +main_repo: https://github.com/atteo/evo-inflector +language: jvm +fuzzing_engines: +- libfuzzer +sanitizers: +- address +vendor_ccs: +- david@adalogics.com +- adam@adalogics.com +- arthur.chan@adalogics.com