summaryrefslogtreecommitdiff
path: root/libs/ultrahdr/jpegdecoderhelper.cpp
diff options
context:
space:
mode:
author Dichen Zhang <dichenzhang@google.com> 2023-06-06 01:07:57 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2023-06-06 01:07:57 +0000
commit05ff67be11fb137d986299ce8f8ed3abc5655e4d (patch)
tree97cd782862570f60ecc62e214d6a786bcf4fb3c8 /libs/ultrahdr/jpegdecoderhelper.cpp
parentcd3f63736194d676c30e2903f87c5d10b30e4b3a (diff)
parentd136b8a2621f064f496cc114957b24588937befa (diff)
Merge "ultrahdr: Add fuzz application for decode api" into udc-dev
Diffstat (limited to 'libs/ultrahdr/jpegdecoderhelper.cpp')
-rw-r--r--libs/ultrahdr/jpegdecoderhelper.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libs/ultrahdr/jpegdecoderhelper.cpp b/libs/ultrahdr/jpegdecoderhelper.cpp
index fac90c503d..2a9bc9ac1e 100644
--- a/libs/ultrahdr/jpegdecoderhelper.cpp
+++ b/libs/ultrahdr/jpegdecoderhelper.cpp
@@ -213,6 +213,12 @@ bool JpegDecoderHelper::decode(const void* image, int length, bool decodeToRGBA)
}
}
+ 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;