From 9bbd928b50077c3a85b3f9bb26889b20099469c0 Mon Sep 17 00:00:00 2001 From: DaShi Date: Tue, 22 Oct 2024 21:33:03 +0800 Subject: [PATCH] [Encode] fix 1 coverity issue check untrusted index --- .../agnostic/common/codec/hal/codechal_vdenc_avc.cpp | 5 +++++ 1 file changed, 5 insertions(+) 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;