Fixed Memory Overflow Errors In function impeg2d_dec_p_b_slice, there was no check for num_mbs_left == 0 after skip_mbs function call. Hence, even though it should have returned as an error, it goes ahead to decode the frame and writes beyond the buffer allocated for output. Put a check for the same. Bug: 38207066 Test: before/after execution of PoC on angler/nyc-mr2-dev Change-Id: If4b7bea51032bf2fe2edd03f64a68847aa4f6a00 (cherry picked from commit 2df080153464bf57084d68ba3594e199bc140eb4)
diff --git a/decoder/impeg2d_pnb_pic.c b/decoder/impeg2d_pnb_pic.c index 5540044..69277e5 100644 --- a/decoder/impeg2d_pnb_pic.c +++ b/decoder/impeg2d_pnb_pic.c
@@ -510,6 +510,12 @@ if(ret) return IMPEG2D_MB_TEX_DECODE_ERR; + + if(0 >= ps_dec->u2_num_mbs_left) + { + break; + } + IMPEG2D_TRACE_MB_START(ps_dec->u2_mb_x, ps_dec->u2_mb_y); u4_x_dst_offset = u4_frm_offset + (ps_dec->u2_mb_x << 4);