From ef2f525becdd4004f07466ecbb8235d0cd6eb9a4 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Tue, 22 Nov 2016 12:24:59 +0530 Subject: [PATCH] Decoder: Reset p_curr_ctxt->i1_ref_idx using memset Since p_curr_ctxt->i1_ref_idx is not guaranteed to be 4 byte aligned, use memset instead of using it as an int pointer. On platforms that do not support unaligned stores, this change is needed Bug: 33073518 Test: Tested with -fsanitize=alignment enabled on avcdec Change-Id: I5970454be3250f6f87eab383f3b6afbf5b56f201 --- decoder/ih264d_parse_islice.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/decoder/ih264d_parse_islice.c b/decoder/ih264d_parse_islice.c index a5072e9..98905ba 100644 --- a/decoder/ih264d_parse_islice.c +++ b/decoder/ih264d_parse_islice.c @@ -509,9 +509,7 @@ WORD32 ih264d_parse_imb_cabac(dec_struct_t * ps_dec, MEMSET_16BYTES(&ps_dec->pu1_left_mv_ctxt_inc[0][0], 0); *((UWORD32 *)ps_dec->pi1_left_ref_idx_ctxt_inc) = 0; MEMSET_16BYTES(p_curr_ctxt->u1_mv, 0); - pi1_buf = p_curr_ctxt->i1_ref_idx; - pi4_buf = (WORD32 *)pi1_buf; - *pi4_buf = 0; + memset(p_curr_ctxt->i1_ref_idx, 0, 4); } if(u1_mb_type == I_4x4_MB)