From d136b8a2621f064f496cc114957b24588937befa Mon Sep 17 00:00:00 2001 From: Ram Mohan Date: Fri, 2 Jun 2023 09:06:40 +0530 Subject: ultrahdr: Add fuzz application for decode api Bug: 282640328 Test: ./ultrahdr_dec_fuzzer Change-Id: I9bd2a314d05122fd3010889b661455a6cba364e6 --- libs/ultrahdr/jpegdecoderhelper.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libs/ultrahdr/jpegdecoderhelper.cpp') 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; -- cgit v1.2.3-59-g8ed1b