History

Fix Issues 13030 and 13039 in oss-fuzz.

xiaotiansf committed 7 years ago

Commit 71d619c1 parent 5ae7dc92 files · +23 −3Browse files

Showing the changes to codec/decoder/core/src/decode_slice.cpp (1 of 2 files). Show all

Unified · Split

codec/decoder/core/src/decode_slice.cpp+21−2
@@ -56,6 +56,22 @@ extern void FreePicture (PPicture pPic, CMemoryAlign* pMa); · 55 unmodified lines
5656
5757 extern PPicture AllocPicture (PWelsDecoderContext pCtx, const int32_t kiPicWidth, const int32_t kiPicHeight);
5858
59+static bool CheckRefPics (const PWelsDecoderContext& pCtx) {
60+ int32_t listCount = 1;
61+ if (pCtx->eSliceType == B_SLICE) {
62+ ++listCount;
63+ }
64+ for (int32_t list = LIST_0; list < listCount; ++list) {
65+ int32_t refCount = pCtx->sRefPic.uiRefCount[list];
66+ for (int32_t refIdx = 0; refIdx < refCount; ++refIdx) {
67+ if (!pCtx->sRefPic.pRefList[list][refIdx]) {
68+ return false;
69+ }
70+ }
71+ }
72+ return true;
73+}
74+
5975 int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) {
6076 PDqLayer pCurLayer = pCtx->pCurDqLayer;
6177 PSlice pCurSlice = &pCurLayer->sLayerInfo.sSliceInLayer;
@@ -318,7 +334,10 @@ int32_t WelsTargetMbConstruction (PWelsDecoderContext pCtx) { · 256 unmodified lines
318334 WelsMbIntraPredictionConstruction (pCtx, pCurLayer, 1);
319335 } else if (IS_INTER (pCurLayer->pMbType[pCurLayer->iMbXyIndex])) { //InterMB
320336 if (0 == pCurLayer->pCbp[pCurLayer->iMbXyIndex]) { //uiCbp==0 include SKIP
321− WelsMbInterPrediction (pCtx, pCurLayer);
337+ if (!CheckRefPics (pCtx)) {
338+ return ERR_INFO_MB_RECON_FAIL;
339+ }
340+ return WelsMbInterPrediction (pCtx, pCurLayer);
322341 } else {
323342 WelsMbInterConstruction (pCtx, pCurLayer);
324343 }
@@ -2783,7 +2802,7 @@ int32_t WelsActualDecodeMbCavlcBSlice (PWelsDecoderContext pCtx) { · 2458 unmodified lines
27832802 return ERR_NONE;
27842803 }
27852804
2786−void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) {
2805+void WelsBlockFuncInit (SBlockFunc* pFunc, int32_t iCpu) {
27872806 pFunc->pWelsSetNonZeroCountFunc = WelsNonZeroCount_c;
27882807 pFunc->pWelsBlockZero16x16Func = WelsBlockZero16x16_c;
27892808 pFunc->pWelsBlockZero8x8Func = WelsBlockZero8x8_c;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t