Validate the u4_entropy_coding_mode field

Previously, if this field wasn't set, the invalid coding mode
could lead to crashes later.

Bug: 22860270

Change-Id: If8dd2f8d5f2fbdd6bb76772344f959df23159167
This commit is contained in:
Martin Storsjo 2015-07-03 13:56:20 +03:00 committed by Marco Nelissen
parent 8ce82804ab
commit 33134b2617
2 changed files with 12 additions and 0 deletions

View file

@ -1758,6 +1758,15 @@ static IV_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
return IV_FAIL;
}
if (ps_ip->s_ive_ip.u4_entropy_coding_mode > 1)
{
ps_op->s_ive_op.u4_error_code |= 1
<< IVE_UNSUPPORTEDPARAM;
ps_op->s_ive_op.u4_error_code |=
IH264E_INVALID_ENTROPY_CODING_MODE;
return IV_FAIL;
}
break;
}

View file

@ -223,6 +223,9 @@ typedef enum
/**Not enough memory allocated as output buffer */
IH264E_INSUFFICIENT_OUTPUT_BUFFER = IH264E_CODEC_ERROR_START + 0x30,
/**Invalid entropy coding mode */
IH264E_INVALID_ENTROPY_CODING_MODE = IH264E_CODEC_ERROR_START + 0x31,
/**max failure error code to ensure enum is 32 bits wide */
IH264E_FAIL = -1,