Skip to content

Commit

Permalink
[Java-Integration]: Link project jackson-databind for fuzz-introspect…
Browse files Browse the repository at this point in the history
…or (#572)

Link project jackson-databind for fuzz-introspector java integration test

Signed-off-by: Arthur Chan <[email protected]>

Signed-off-by: Arthur Chan <[email protected]>
  • Loading branch information
arthurscchan authored Oct 28, 2022
1 parent 406f0f2 commit a806bf7
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions oss_fuzz_integration/oss-fuzz-patches.diff
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,45 @@ index 98f406ad..62485ae4 100644
python3 ./setup.py --without-libyaml install

# Build fuzzers in $OUT.
diff --git a/projects/jackson-databind/build.sh b/projects/jackson-databind/build.sh
index e4cfde02..52e42731 100755
--- a/projects/jackson-databind/build.sh
+++ b/projects/jackson-databind/build.sh
@@ -55,6 +55,9 @@ BUILD_CLASSPATH=$(echo $ALL_JARS | xargs printf -- "$OUT/%s:"):$JAZZER_API_PATH
# All .jar and .class files lie in the same directory as the fuzzer at runtime.
RUNTIME_CLASSPATH=$(echo $ALL_JARS | xargs printf -- "\$this_dir/%s:"):\$this_dir

+jarfile=
+class=
+
for fuzzer in $(find $SRC -name '*Fuzzer.java'); do
fuzzer_basename=$(basename -s .java $fuzzer)
javac -cp $BUILD_CLASSPATH $fuzzer
@@ -87,5 +90,26 @@ LD_LIBRARY_PATH=\"$JVM_LD_LIBRARY_PATH\":\$this_dir \
chmod u+x $OUT/$fuzzer_basename

# Build up jar for fuzz-introspector
-jar cvf $OUT/$fuzzer_basename.jar $SRC/$fuzzer_basename*.class
+cd $OUT
+jar cvf $fuzzer_basename.jar $fuzzer_basename*.class
+if [ -z "$jarfile" ]
+then
+ jarfile=$OUT/$fuzzer_basename.jar
+ class=$fuzzer_basename
+else
+ jarfile=$jarfile:$OUT/$fuzzer_basename.jar
+ class=$class:$fuzzer_basename
+fi
+cd -
done
+
+cd $OUT
+rm -rf fuzz-introspector
+git clone https://github.com/ossf/fuzz-introspector
+jarfile=$jarfile:$OUT/jackson-databind.jar:$OUT/jackson-core.jar:$OUT/jackson-annotations.jar
+cd fuzz-introspector/frontends/java/soot
+sed -i 's/mvn/$MVN/g' run.sh
+./run.sh -j $jarfile -c $class -m fuzzerTestOneInput
+cd $OUT
+cp fuzz-introspector/frontends/java/soot/*.txt ./
+rm -rf fuzz-introspector

0 comments on commit a806bf7

Please sign in to comment.