Skip to content

Commit 0613d11

Browse files
stellawuintelgfxVPLsdm
authored andcommitted
[MPEG2 Encode] Fix Coverity CID 4398024: INTEGER_OVERFLOW in VAAPIEncoder::SetFrames
In SetFrames, when m_RecFrameMemID is null, ind was set to 0xff (255). This value is then assigned into CurrReconstructedPic.Index7Bits and CurrOriginalPic.Index7Bits, both typed as UCHAR:7 (max 127), causing Coverity to flag INTEGER_OVERFLOW (CWE-190). Fix: use 0x7f as the invalid frame sentinel, which is the correct maximum value for the 7-bit field and explicitly safe-by-construction. No functional regression: hardware already truncated 0xff to 0x7f.
1 parent 32c8dda commit 0613d11

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

_studio/mfx_lib/ext/mpeg2/src/mfx_mpeg2_encode_vaapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1406,7 +1406,7 @@ mfxStatus VAAPIEncoder::SetFrames (ExecuteBuffers* pExecuteBuffers)
14061406
}
14071407
else
14081408
{
1409-
ind = 0xff;
1409+
ind = 0x7f; // max value for 7-bit Index7Bits field (invalid frame sentinel)
14101410
}
14111411

14121412
pExecuteBuffers->m_pps.CurrReconstructedPic.Index7Bits = mfxU8(ind < 0 ? 0 : ind);

0 commit comments

Comments
 (0)