1
0
Fork 0

Fix possible out-of-bounds read of workaround for DecodeHeader.

This commit is contained in:
Yusuke Nakamura 2015-03-25 03:59:06 +09:00 committed by Hendrik Leppkes
parent 36b2fcd804
commit c0fb039708
1 changed files with 3 additions and 2 deletions

View File

@ -419,9 +419,10 @@ mfxStatus CQuickSyncDecoder::DecodeHeader(mfxBitstream* bs, mfxVideoParam* par)
{
mfxBitstream bs2 = *bs;
bs2.DataOffset = 0;
bs2.Data = new mfxU8[bs->DataLength + 5];
memcpy(bs2.Data, bs->Data + bs->DataOffset, bs->DataLength - bs->DataOffset);
bs2.MaxLength = bs2.DataLength = bs->DataLength + 5 - bs->DataOffset;
memcpy(bs2.Data, bs->Data + bs->DataOffset, bs->DataLength);
bs2.MaxLength = bs2.DataLength = bs->DataLength + 5;
// Write H264 start code + start of splice section
*((unsigned*)(bs2.Data + bs2.DataLength - 5)) = 0x01000000;