ultrahdr: Add fuzz application for decode api
Bug: 282640328
Test: ./ultrahdr_dec_fuzzer
Change-Id: I9bd2a314d05122fd3010889b661455a6cba364e6
diff --git a/libs/ultrahdr/jpegdecoderhelper.cpp b/libs/ultrahdr/jpegdecoderhelper.cpp
index fac90c5..2a9bc9a 100644
--- a/libs/ultrahdr/jpegdecoderhelper.cpp
+++ b/libs/ultrahdr/jpegdecoderhelper.cpp
@@ -213,6 +213,12 @@
}
}
+ if (cinfo.image_width > kMaxWidth || cinfo.image_height > kMaxHeight) {
+ // constraint on max width and max height is only due to alloc constraints
+ // tune these values basing on the target device
+ return false;
+ }
+
mWidth = cinfo.image_width;
mHeight = cinfo.image_height;