Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
[jpegd] Check that number of scans is not exceeding maximum
Browse files Browse the repository at this point in the history
  • Loading branch information
filippenkos authored and dmitryermilov committed Apr 2, 2021
1 parent c4fbaed commit 510d19d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 15 additions & 1 deletion _studio/mfx_lib/decode/mjpeg/src/mfx_mjpeg_dec_decode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,21 @@ mfxStatus VideoDECODEMJPEG::DecodeFrameCheck(mfxBitstream *bs, mfxFrameSurface1
m_isHeaderFound = false;
m_isHeaderParsed = false;

MFX_SAFE_CALL(decoder->AddPicture(pSrcData, numPic));
try
{
MFX_SAFE_CALL(decoder->AddPicture(pSrcData, numPic));
}
catch(const UMC::eUMC_Status& sts)
{
if(sts == UMC::UMC_ERR_INVALID_STREAM)
{
continue;
}
else
{
return ConvertUMCStatusToMfx(sts);
}
}
// make sure, that we collected BOTH fields
} while (picToCollect > numPic);

Expand Down
4 changes: 4 additions & 0 deletions _studio/shared/umc/codec/jpeg_dec/src/mfx_mjpeg_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,10 @@ mfxStatus CJpegTask::AddPicture(UMC::MediaDataEx *pSrcData,
m_pics[m_numPic]->scanOffset[numScans] = pAuxData->offsets[i];
m_pics[m_numPic]->scanSize[numScans] = chunkSize;
numScans += 1;
if (numScans >= maxNumScans)
{
throw UMC::UMC_ERR_INVALID_STREAM;
}
}
else if ((JM_DRI == marker || JM_DQT == marker || JM_DHT == marker) && 0 != numScans)
{
Expand Down

0 comments on commit 510d19d

Please sign in to comment.