From e98bd1f5a0e268ac6a4a65e6996d2a38d571ab1d Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Tue, 22 Nov 2016 12:23:34 +0530 Subject: [PATCH] Decoder: Aligned pi1_left_pred_mode[8] in _DecStruct definition This array is sometimes accessed as two WORD32 variables. On platforms that do not support unaligned load/stores, this needs to be aligned to 4 byte boundary. Bug: 33073518 Test: Tested with -fsanitize=alignment enabled on avcdec Change-Id: I470bc868dde7049be12bee06ee0ba0c4c4bd8566 --- decoder/ih264d_structs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/decoder/ih264d_structs.h b/decoder/ih264d_structs.h index 4260393..d8b02da 100644 --- a/decoder/ih264d_structs.h +++ b/decoder/ih264d_structs.h @@ -1057,7 +1057,6 @@ typedef struct _DecStruct prev_seq_params_t s_prev_seq_params; UWORD8 u1_cur_mb_fld_dec_flag; /* current Mb fld or Frm */ - WORD8 pi1_left_pred_mode[8]; UWORD8 u1_topleft_mb_fld; UWORD8 u1_topleft_mbtype; UWORD8 u1_topleft_mb_fld_bot; @@ -1067,6 +1066,9 @@ typedef struct _DecStruct UWORD16 u2_top_left_mask; UWORD16 u2_top_right_mask; dec_err_status_t * ps_dec_err_status; + /* Ensure pi1_left_pred_mode is aligned to 4 byte boundary, + by declaring this after a pointer or an integer */ + WORD8 pi1_left_pred_mode[8]; UWORD8 u1_mb_idx_mv; UWORD16 u2_mv_2mb[2];