Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java-Integration]: Link project jackson-databind for fuzz-introspector #572

Merged
merged 1 commit into from
Oct 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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