Skip to content

Commit

Permalink
Fix oss-fuzz patch (#2058)
Browse files Browse the repository at this point in the history
* Fix oss-fuzz patch

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>

* Fix patch

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>

* Fix patch

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>

---------

Signed-off-by: Arthur Chan <arthur.chan@adalogics.com>
  • Loading branch information
arthurscchan authored Feb 5, 2025
1 parent 16c71e1 commit 1c4abeb
Showing 1 changed file with 57 additions and 1 deletion.
58 changes: 57 additions & 1 deletion oss_fuzz_integration/oss-fuzz-patches.diff
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ index 64d11095b..34bee0c13 100644
# /ccache/bin will contain the compiler wrappers, and /ccache/cache will
# contain the actual cache, which can be saved.
diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile
index e05d0e6ea..eccd5c3b3 100755
index e05d0e6ea..2554b9d3f 100755
--- a/infra/base-images/base-builder/compile
+++ b/infra/base-images/base-builder/compile
@@ -235,6 +235,8 @@ if [ "$SANITIZER" = "introspector" ] || [ "$RUST_SANITIZER" = "introspector" ];
Expand All @@ -32,6 +32,62 @@ index e05d0e6ea..eccd5c3b3 100755
elif [ "$FUZZING_LANGUAGE" = "jvm" ]; then
python3 /fuzz-introspector/src/main.py light --language=jvm
cp -rf $SRC/inspector/ /tmp/inspector-saved
@@ -353,28 +355,7 @@ if [ "$SANITIZER" = "introspector" ] || [ "$RUST_SANITIZER" = "introspector" ];
python3 -m pip install -e .
cd /src/

- if [ "$FUZZING_LANGUAGE" = "jvm" ]; then
- echo "GOING jvm route"
-
- set -x
- # Output will be put in /out/
- python3 -m fuzz_introspector.frontends.oss_fuzz --language jvm --target-dir $SRC --entrypoint fuzzerTestOneInput
-
- # Move files temporarily to fit workflow of other languages.
- mkdir -p $SRC/my-fi-data
- find ./ -name *.data -exec mv {} $SRC/my-fi-data/ \;
- find ./ -name *.data.yaml -exec mv {} $SRC/my-fi-data/ \;
- elif [ "$FUZZING_LANGUAGE" = "rust" ]; then
- echo "GOING rust route"
-
- # Run the rust frontend
- python3 -m fuzz_introspector.frontends.oss_fuzz --language rust --target-dir $SRC
-
- # Move files temporarily to fix workflow of other languages.
- mkdir -p $SRC/my-fi-data
- find ./ -name "*.data" -exec mv {} $SRC/my-fi-data/ \;
- find ./ -name "*.data.yaml" -exec mv {} $SRC/my-fi-data/ \;
-
+ if [ "$FUZZING_LANGUAGE" = "rust" ]; then
# Restore the sanitizer flag for rust
export SANITIZER="introspector"
fi
@@ -413,15 +394,21 @@ if [ "$SANITIZER" = "introspector" ] || [ "$RUST_SANITIZER" = "introspector" ];
echo "GOING jvm route"
set -x
find $OUT/ -name "jacoco.xml" -exec cp {} $SRC/inspector/ \;
- REPORT_ARGS="$REPORT_ARGS --target-dir=$SRC/inspector"
+ REPORT_ARGS="$REPORT_ARGS --target-dir=$SRC --out-dir=$SRC/inspector"
REPORT_ARGS="$REPORT_ARGS --language=jvm"
- fuzz-introspector report $REPORT_ARGS
+ fuzz-introspector full $REPORT_ARGS
rsync -avu --delete "$SRC/inspector/" "$OUT/inspector"
elif [ "$FUZZING_LANGUAGE" = "rust" ]; then
echo "GOING rust route"
- REPORT_ARGS="$REPORT_ARGS --target-dir=$SRC/inspector"
+ REPORT_ARGS="$REPORT_ARGS --target-dir=$SRC --out-dir=$SRC/inspector"
REPORT_ARGS="$REPORT_ARGS --language=rust"
- fuzz-introspector report $REPORT_ARGS
+ fuzz-introspector full $REPORT_ARGS
+ rsync -avu --delete "$SRC/inspector/" "$OUT/inspector"
+ elif [ "$FUZZING_LANGUAGE" = "go" ]; then
+ echo "GOING go route"
+ REPORT_ARGS="$REPORT_ARGS --target-dir=$SRC --out-dir=$SRC/inspector"
+ REPORT_ARGS="$REPORT_ARGS --language=go"
+ fuzz-introspector full $REPORT_ARGS
rsync -avu --delete "$SRC/inspector/" "$OUT/inspector"
else
# C/C++
diff --git a/infra/base-images/base-clang/Dockerfile b/infra/base-images/base-clang/Dockerfile
index 296b1f7fb..9c6b1ff55 100644
--- a/infra/base-images/base-clang/Dockerfile
Expand Down

0 comments on commit 1c4abeb

Please sign in to comment.