Decoder: Fixes an out of bound write in bitstream buffer am: 33ef7de9dd am: 0aab4958fb am: 9f72b6eca1 am: 73a3e320d8 am: 89377f2acf am: 9801d7e8d5

am: 109509aeb0

Change-Id: Ifa6a068e0139c26beee6f0d455de63b2c6bac34c
This commit is contained in:
Harish Mahendrakar 2017-02-13 18:59:46 +00:00 committed by android-build-merger
commit cb36e15c72

View file

@ -1989,7 +1989,9 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
if(buflen == -1)
buflen = 0;
/* Ignore bytes beyond the allocated size of intermediate buffer */
buflen = MIN(buflen, buf_size);
/* Since 8 bytes are read ahead, ensure 8 bytes are free at the
end of the buffer, which will be memset to 0 after emulation prevention */
buflen = MIN(buflen, buf_size - 8);
bytes_consumed = buflen + u4_length_of_start_code;
ps_dec_op->u4_num_bytes_consumed += bytes_consumed;