AImageDecoder: Add a fuzz target
Bug: 142252770
Bug: 169137236
Bug: 169139756
Test: This (fuzzer)
Use the bytes to create an image file and decode it.
To run:
$ SANITIZE_TARGET=hwaddress make imagedecoder_fuzzer
$ adb root
$ adb sync data
$ adb shell /data/fuzz/arm64/imagedecoder_fuzzer/imagedecoder_fuzzer
Call startThreadPool() to support HEIF. Otherwise HEIF decodes may time
out on binder IPC calls. This is similar to a fix for skia_dm in
https://skia-review.googlesource.com/c/skia/+/108141.
Change-Id: I434730a74c5ff97437526065c41af3f54fae3335
diff --git a/native/graphics/jni/Android.bp b/native/graphics/jni/Android.bp
index 15b473c..aaaaa01 100644
--- a/native/graphics/jni/Android.bp
+++ b/native/graphics/jni/Android.bp
@@ -58,3 +58,18 @@
first_version: "9",
unversioned_until: "current",
}
+
+cc_fuzz {
+ name: "imagedecoder_fuzzer",
+ srcs: ["fuzz_imagedecoder.cpp"],
+ header_libs: ["jni_headers"],
+ shared_libs: [
+ "libbinder",
+ "libjnigraphics",
+ "libutils",
+ ],
+ static_libs: ["libarect"],
+ fuzz_config: {
+ cc: ["scroggo@google.com"],
+ },
+}