Merge cherrypicks of [4793300, 4793320, 4793321, 4793340, 4793322, 4793061, 4793323, 4793324, 4793325, 4793380, 4793341, 4793342, 4793343, 4793265, 4793131, 4793132, 4793266, 4793133, 4793134, 4793400, 4793229, 4793381, 4793382, 4793383, 4793384, 4793385, 4793386, 4793387, 4793388, 4793062, 4793105, 4793063, 4793135, 4793389, 4793420] into pi-release

Change-Id: I578ce945ef134c79c121a10c5c77ff59aab14c43
diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c
index e899347..c4fcee5 100644
--- a/decoder/impeg2d_dec_hdr.c
+++ b/decoder/impeg2d_dec_hdr.c
@@ -167,10 +167,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
         {
@@ -193,6 +189,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 */
@@ -210,6 +211,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;