Merge the 2019-01-01 SPL branch from AOSP-Partner
* security-aosp-nyc-mr2-release:
Handle Unsupported Dimensions in Test App
Adding check for min_width and min_height
Change-Id: I02b5e9566f13cf73ef04b8d268b865c0b36e0246
diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c
index 6bb0a85..3bd5151 100644
--- a/decoder/impeg2d_dec_hdr.c
+++ b/decoder/impeg2d_dec_hdr.c
@@ -166,10 +166,6 @@
/* This is the first time we are reading the resolution */
ps_dec->u2_horizontal_size = u2_width;
ps_dec->u2_vertical_size = u2_height;
- if (0 == ps_dec->u4_frm_buf_stride)
- {
- ps_dec->u4_frm_buf_stride = (UWORD32) (u2_width);
- }
}
else
{
@@ -192,6 +188,11 @@
return e_error;
}
+ else if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
else
{
/* The resolution has changed */
@@ -209,6 +210,11 @@
return e_error;
}
+ if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
/*------------------------------------------------------------------------*/
/* Flush the following as they are not being used */
diff --git a/decoder/impeg2d_decoder.c b/decoder/impeg2d_decoder.c
index bff8c21..726d9cd 100644
--- a/decoder/impeg2d_decoder.c
+++ b/decoder/impeg2d_decoder.c
@@ -155,6 +155,12 @@
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
}
ps_op->s_ivd_video_decode_op_t.u4_frame_decoded_flag = 0;
+
+ /* Set the stride */
+ if (0 == ps_dec->u4_frm_buf_stride)
+ {
+ ps_dec->u4_frm_buf_stride = ps_dec->u2_horizontal_size;
+ }
/* MOD */
ps_dec->u2_header_done = 1;
diff --git a/test/decoder/main.c b/test/decoder/main.c
index 6229f50..9502dec 100644
--- a/test/decoder/main.c
+++ b/test/decoder/main.c
@@ -2415,9 +2415,13 @@
if(ret != IV_SUCCESS)
{
+ if (IMPEG2D_UNSUPPORTED_DIMENSIONS == s_video_decode_op.u4_error_code)
+ {
+ sprintf(ac_error_str, "\nSummary\nUnsupported Dimensions. Reinit decoder with width %d and height %d\n", s_video_decode_op.u4_pic_wd, s_video_decode_op.u4_pic_ht);
+ codec_exit(ac_error_str);
+ }
sprintf(ac_error_str, "\nError in header decode %x",
s_video_decode_op.u4_error_code);
- // codec_exit(ac_error_str);
}
u4_num_bytes_dec = s_video_decode_op.u4_num_bytes_consumed;