diff --git a/infra/base-images/base-builder/indexer/manifest_types.py b/infra/base-images/base-builder/indexer/manifest_types.py index bb4239c695be..664d4dc01ee5 100644 --- a/infra/base-images/base-builder/indexer/manifest_types.py +++ b/infra/base-images/base-builder/indexer/manifest_types.py @@ -38,6 +38,7 @@ import urllib.request import manifest_constants + import pathlib SRC_DIR = manifest_constants.SRC_DIR @@ -433,7 +434,7 @@ def save_build( with tempfile.NamedTemporaryFile() as tmp: mode = "w:gz" if archive_path.suffix.endswith("gz") else "w" - with tarfile.open(tmp.name, mode) as tar: + with tarfile.open(tmp.name, mode, dereference=True) as tar: def _save_dir( path: pathlib.PurePath, diff --git a/projects/calcite-avatica/Base64Fuzzer.java b/projects/calcite-avatica/Base64Fuzzer.java deleted file mode 100644 index 2f2cb51ed540..000000000000 --- a/projects/calcite-avatica/Base64Fuzzer.java +++ /dev/null @@ -1,36 +0,0 @@ -// 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 java.io.IOException; -import org.apache.calcite.avatica.util.Base64; - -// Generated with https://github.com/ossf/fuzz-introspector/tree/main/tools/auto-fuzz -// Minor modifications to beautify code and ensure exception is caught. -// Heuristic name: jvm-autofuzz-heuristics-1 -// Target method: [org.apache.calcite.avatica.util.Base64] public static java.lang.String encodeBytes(byte[],int) throws java.io.IOException -public class Base64Fuzzer { - public static void fuzzerTestOneInput(FuzzedDataProvider data) { - try { - if (data.consumeBoolean()) { - Base64.encodeBytes(data.consumeRemainingAsBytes()); - } else { - Base64.decode(data.consumeRemainingAsBytes()); - } - } catch (IOException | IllegalArgumentException e) { - // Known exception - } - } -} diff --git a/projects/calcite-avatica/ConnectStringParserFuzzer.java b/projects/calcite-avatica/ConnectStringParserFuzzer.java deleted file mode 100644 index 282c6d3c9ddd..000000000000 --- a/projects/calcite-avatica/ConnectStringParserFuzzer.java +++ /dev/null @@ -1,33 +0,0 @@ -// 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 java.sql.SQLException; -import java.util.Properties; -import org.apache.calcite.avatica.ConnectStringParser; - -// Generated with https://github.com/ossf/fuzz-introspector/tree/main/tools/auto-fuzz -// Minor modifications to beautify code and ensure exception is caught. -// Heuristic name: jvm-autofuzz-heuristics-1 -// Target method: [org.apache.calcite.avatica.ConnectStringParser] public static java.util.Properties parse(java.lang.String) throws java.sql.SQLException -public class ConnectStringParserFuzzer { - public static void fuzzerTestOneInput(FuzzedDataProvider data) { - try { - ConnectStringParser.parse(data.consumeRemainingAsString()); - } catch (SQLException e) { - // Known exception - } - } -} diff --git a/projects/calcite-avatica/Dockerfile b/projects/calcite-avatica/Dockerfile index cd492ad27b49..880b47070ef5 100644 --- a/projects/calcite-avatica/Dockerfile +++ b/projects/calcite-avatica/Dockerfile @@ -15,5 +15,5 @@ ########################################################################## FROM gcr.io/oss-fuzz-base/base-builder-jvm RUN git clone --depth 1 https://github.com/apache/calcite-avatica calcite-avatica -COPY *.sh *.java $SRC/ +COPY *.sh $SRC/ WORKDIR $SRC/calcite-avatica diff --git a/projects/calcite-avatica/build.sh b/projects/calcite-avatica/build.sh index aa4d8ad499a2..17cc52e0266e 100644 --- a/projects/calcite-avatica/build.sh +++ b/projects/calcite-avatica/build.sh @@ -15,31 +15,40 @@ # ########################################################################## -# Gradle build with gradle wrapper +# Clean up caches rm -rf $HOME/.gradle/caches/ -./gradlew clean build shadowJar -x test + +# Build project and copy dependencies +./gradlew clean :core:jar :core:testClasses :core:copyFuzzDependencies -x test ./gradlew --stop +# Find version CURRENT_VERSION=$(./gradlew properties | grep ^version: | cut -d" " -f2) -cp "./shaded/core/build/libs/avatica-$CURRENT_VERSION-shadow.jar" $OUT/avatica.jar -ALL_JARS="avatica.jar" -# The classpath at build-time includes the project jars in $OUT as well as the -# Jazzer API. -BUILD_CLASSPATH=$(echo $ALL_JARS | xargs printf -- "$OUT/%s:"):$JAZZER_API_PATH +# Copy jars to $OUT +cp core/build/fuzz-dependencies/*.jar $OUT/ +cp core/build/libs/avatica-core-$CURRENT_VERSION.jar $OUT/avatica-core.jar +cp metrics/build/libs/avatica-metrics-$CURRENT_VERSION.jar $OUT/avatica-metrics.jar + +# Copy fuzzer classes to $OUT (preserving package structure) +cp -r core/build/classes/java/test/* $OUT/ + +# Create a consolidated list of all jars for the classpath +ALL_JARS=$(find $OUT -maxdepth 1 -name "*.jar" | xargs -n1 basename) -# All .jar and .class files lie in the same directory as the fuzzer at runtime. +# The runtime classpath will include all jars in $OUT and the this_dir itself for classes RUNTIME_CLASSPATH=$(echo $ALL_JARS | xargs printf -- "\$this_dir/%s:"):\$this_dir -for fuzzer in $(find $SRC -maxdepth 1 -name '*Fuzzer.java') -do - fuzzer_basename=$(basename -s .java $fuzzer) - javac -cp $BUILD_CLASSPATH $fuzzer - cp $SRC/$fuzzer_basename.class $OUT/ +# Dynamically find all fuzzer classes in the specified package +FUZZER_CLASSES_DIR="$OUT/org/apache/calcite/avatica/fuzz" +FUZZERS=$(find "$FUZZER_CLASSES_DIR" -maxdepth 1 -name "*Fuzzer.class" -exec basename {} .class \;) - # Create an execution wrapper that executes Jazzer with the correct arguments. +# For each fuzzer, create a wrapper script +for fuzzer_basename in $FUZZERS +do + target_class="org.apache.calcite.avatica.fuzz.$fuzzer_basename" + echo "#!/bin/bash - # LLVMFuzzerTestOneInput for fuzzer detection. this_dir=\$(dirname "\$0") if [[ "\$@" =~ (^| )-runs=[0-9]+($| ) ]] @@ -49,13 +58,13 @@ do mem_settings='-Xmx2048m:-Xss1024k' fi - LD_LIBRARY_PATH="$JVM_LD_LIBRARY_PATH":\$this_dir \ + LD_LIBRARY_PATH=\"$JVM_LD_LIBRARY_PATH\":\$this_dir \ \$this_dir/jazzer_driver \ --agent_path=\$this_dir/jazzer_agent_deploy.jar \ --cp=$RUNTIME_CLASSPATH \ - --target_class=$fuzzer_basename \ - --jvm_args="\$mem_settings" \ + --target_class=$target_class \ + --jvm_args=\"\$mem_settings\" \ \$@" > $OUT/$fuzzer_basename - chmod u+x $OUT/$fuzzer_basename + chmod u+x $OUT/$fuzzer_basename done diff --git a/projects/geos/Dockerfile b/projects/geos/Dockerfile index 735e0afd3495..a009ab7e87c2 100644 --- a/projects/geos/Dockerfile +++ b/projects/geos/Dockerfile @@ -17,6 +17,6 @@ FROM gcr.io/oss-fuzz-base/base-builder RUN apt-get update && apt-get install -y cmake # fallback to github if main git server is not responding -RUN git clone --depth 1 https://git.osgeo.org/gitea/geos/geos.git || git clone --depth 1 https://github.com/libgeos/geos.git +RUN git clone --depth 1 https://gitea.osgeo.org/geos/geos || git clone --depth 1 https://github.com/libgeos/geos.git COPY run_tests.sh build.sh $SRC/ WORKDIR $SRC/geos diff --git a/projects/geos/project.yaml b/projects/geos/project.yaml index 940f0c93eff9..739388aca0c2 100644 --- a/projects/geos/project.yaml +++ b/projects/geos/project.yaml @@ -9,7 +9,7 @@ auto_ccs : sanitizers: - address - undefined -main_repo: 'https://git.osgeo.org/gitea/geos/geos.git' +main_repo: "https://gitea.osgeo.org/geos/geos" fuzzing_engines: - afl diff --git a/projects/poppler/project.yaml b/projects/poppler/project.yaml index 0e752a504283..66d7e8da827c 100644 --- a/projects/poppler/project.yaml +++ b/projects/poppler/project.yaml @@ -12,7 +12,7 @@ fuzzing_engines: auto_ccs: - jonathan@titanous.com - adam.reichold@t-online.de -main_repo: 'https://anongit.freedesktop.org/git/poppler/poppler.git' +main_repo: "https://gitlab.freedesktop.org/poppler/poppler" fuzzing_engines: - afl - honggfuzz diff --git a/projects/postgis/Dockerfile b/projects/postgis/Dockerfile index 824a76075ce9..69bdf947215d 100644 --- a/projects/postgis/Dockerfile +++ b/projects/postgis/Dockerfile @@ -16,7 +16,7 @@ FROM gcr.io/oss-fuzz-base/base-builder:ubuntu-24-04 -RUN git clone --depth 1 https://git.osgeo.org/gitea/postgis/postgis.git postgis +RUN git clone --depth 1 https://gitea.osgeo.org/postgis/postgis postgis WORKDIR postgis RUN bash ./fuzzers/install_oss_fuzz_build_deps.sh RUN apt-get update && \ diff --git a/projects/postgis/project.yaml b/projects/postgis/project.yaml index a345e12c55df..686801bc0ce1 100644 --- a/projects/postgis/project.yaml +++ b/projects/postgis/project.yaml @@ -6,7 +6,7 @@ auto_ccs: - "even.rouault@gmail.com" - "pramsey@cleverelephant.ca" - "komzpa@gmail.com" -main_repo: 'https://git.osgeo.org/gitea/postgis/postgis.git' +main_repo: "https://gitea.osgeo.org/postgis/postgis" fuzzing_engines: - afl diff --git a/projects/python-markdownify/Dockerfile b/projects/python-markdownify/Dockerfile index a924e07ebd5e..448c3aebbd34 100644 --- a/projects/python-markdownify/Dockerfile +++ b/projects/python-markdownify/Dockerfile @@ -15,6 +15,6 @@ ########################################################################## FROM gcr.io/oss-fuzz-base/base-builder-python RUN pip3 install --upgrade pip -RUN git clone http://github.com/matthewwithanm/python-markdownify python-markdownify +RUN git clone https://github.com/matthewwithanm/python-markdownify python-markdownify COPY *.sh *py $SRC/ WORKDIR $SRC/python-markdownify diff --git a/projects/python-markdownify/project.yaml b/projects/python-markdownify/project.yaml index de472f426174..5899fedaa390 100644 --- a/projects/python-markdownify/project.yaml +++ b/projects/python-markdownify/project.yaml @@ -1,5 +1,5 @@ -homepage: http://github.com/matthewwithanm/python-markdownify -main_repo: http://github.com/matthewwithanm/python-markdownify +homepage: https://github.com/matthewwithanm/python-markdownify +main_repo: https://github.com/matthewwithanm/python-markdownify language: python fuzzing_engines: - libfuzzer