From f377e8cb050a917d04fcfd7517ead3c2782ec768 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Wed, 26 Aug 2015 16:17:55 +0530 Subject: [PATCH] Decoder: Memset 8 extra bytes at the end of internal bitstream buffer Decoder may read 8 extra bytes at the end of this buffer, though it will never be used Setting it to zero will ensure unitialized reads are avoided Change-Id: I724239861cb9fa64f3a70cb5450e094cb3afa20c --- decoder/ih264d_api.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index ddbf769..fc21a06 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -1955,6 +1955,11 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) { memcpy(pu1_bitstrm_buf, pu1_buf + u4_length_of_start_code, buflen); + /* Decoder may read extra 8 bytes near end of the frame */ + if((buflen + 8) < buf_size) + { + memset(pu1_bitstrm_buf + buflen, 0, 8); + } u4_first_start_code_found = 1; }