Skip to content

Commit 42f6f23

Browse files
dmitryermilovSherry-Lin
authored andcommitted
[Decode] Added copy range check for BDW
Fixes #537 Signed-off-by: Dmitry Ermilov <dmitry.ermilov@intel.com>
1 parent b8f3c0c commit 42f6f23

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

media_driver/agnostic/common/codec/hal/codechal_decode_mpeg2.cpp

+7-12
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,13 @@ MOS_STATUS CodechalDecodeMpeg2::CopyDataSurface(
218218
"Failed to allocate copied residual data buffer.");
219219
}
220220

221-
// initialize lock flags
222-
MOS_LOCK_PARAMS lockFlagsWriteOnly;
223-
MOS_ZeroMemory(&lockFlagsWriteOnly, sizeof(MOS_LOCK_PARAMS));
224-
lockFlagsWriteOnly.WriteOnly = 1;
221+
if ((m_nextCopiedDataOffset + dataSize) > m_copiedDataBufferSize)
222+
{
223+
CODECHAL_DECODE_ASSERTMESSAGE("Copied data buffer is not large enough.");
224+
225+
m_slicesInvalid = true;
226+
return MOS_STATUS_UNKNOWN;
227+
}
225228

226229
uint32_t size = MOS_ALIGN_CEIL(dataSize, 16); // 16 byte aligned
227230

@@ -245,14 +248,6 @@ MOS_STATUS CodechalDecodeMpeg2::CopyDataSurface(
245248
return MOS_STATUS_SUCCESS;
246249
}
247250

248-
if ((m_nextCopiedDataOffset + dataSize) > m_copiedDataBufferSize)
249-
{
250-
CODECHAL_DECODE_ASSERTMESSAGE("Copied data buffer is not large enough.");
251-
252-
m_slicesInvalid = true;
253-
return MOS_STATUS_UNKNOWN;
254-
}
255-
256251
CODECHAL_DECODE_CHK_STATUS_RETURN(m_osInterface->pfnSetGpuContext(
257252
m_osInterface,
258253
m_videoContextForWa));

0 commit comments

Comments
 (0)