aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManisha Jajoo <manisha.jajoo@ittiam.com>2021-07-29 09:39:54 +0530
committerRay Essick <essick@google.com>2021-09-20 18:45:52 +0000
commit2f3d043b17d00df222ec19c11014c7de27caa6f5 (patch)
treec648bf7eeb74aeac43906c6863bbab1d07033e8d
parentf9116ab2ac1da017b448e873ce5abc04866953cc (diff)
downloadlibavc-2f3d043b17d00df222ec19c11014c7de27caa6f5.tar.gz
Encoder: Fix memory uninitialized issue in the encoder
Test: atest android.mediav2.cts.CodecEncoderTest Test: atest VtsHalMediaC2V1_0TargetVideoEncTest Bug: 193442575 Change-Id: I75475d3bb822fa0e0493ecc2d67c7da26a907d19 (cherry picked from commit c9d7c5cda489548e7de9aafc3c6eef5b2ce61153)
-rw-r--r--encoder/ih264e_api.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/encoder/ih264e_api.c b/encoder/ih264e_api.c
index 53067e0..1f69e3e 100644
--- a/encoder/ih264e_api.c
+++ b/encoder/ih264e_api.c
@@ -4132,6 +4132,13 @@ static WORD32 ih264e_init_mem_rec(iv_obj_t *ps_codec_obj,
/* mem records */
ps_mem_rec_base = ps_ip->s_ive_ip.ps_mem_rec;
+ /* memset all allocated memory, except the first one. First buffer (i.e. i == MEM_REC_IV_OBJ)
+ is initialized by application before calling this init function */
+ for (i = MEM_REC_CODEC; i < MEM_REC_CNT; i++)
+ {
+ ps_mem_rec = &ps_mem_rec_base[i];
+ memset(ps_mem_rec->pv_base, 0, ps_mem_rec->u4_mem_size);
+ }
/* Init mem records */
ps_mem_rec = &ps_mem_rec_base[MEM_REC_CODEC];