diff --git a/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp b/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp index 80a80ff7169..e10038d6c3e 100644 --- a/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp +++ b/media_driver/agnostic/common/codec/hal/codechal_vdenc_avc.cpp @@ -5830,6 +5830,11 @@ MOS_STATUS CodechalVdencAvcState::InitializePicture(const EncoderParams ¶ms) CODECHAL_ENCODE_AVC_TQ_INPUT_PARAMS tqInputParams; tqInputParams.ucQP = sliceQP; tqInputParams.ucTargetUsage = m_avcSeqParam->TargetUsage; + if (tqInputParams.ucTargetUsage >= NUM_VDENC_TARGET_USAGE_MODES) + { + CODECHAL_ENCODE_ASSERTMESSAGE("Invalid sequence parameter."); + return MOS_STATUS_INVALID_PARAMETER; + } tqInputParams.wPictureCodingType = m_pictureCodingType; tqInputParams.bBrcEnabled = false; tqInputParams.bVdEncEnabled = true;