diff --git a/codec/decoder/core/src/decode_slice.cpp b/codec/decoder/core/src/decode_slice.cpp index 6c728a57..bd09f195 100644 --- a/codec/decoder/core/src/decode_slice.cpp +++ b/codec/decoder/core/src/decode_slice.cpp @@ -79,8 +79,8 @@ int32_t WelsTargetSliceConstruction (PWelsDecoderContext pCtx) { pCurLayer->iMbXyIndex = iNextMbXyIndex; if (0 == iNextMbXyIndex) { - pCurLayer->pDec->iSpsId = pSliceHeader->iSpsId; - pCurLayer->pDec->iPpsId = pSliceHeader->iPpsId; + pCurLayer->pDec->iSpsId = pCtx->pSps->iSpsId; + pCurLayer->pDec->iPpsId = pCtx->pPps->iPpsId; pCurLayer->pDec->uiQualityId = pCurLayer->sLayerInfo.sNalHeaderExt.uiQualityId; } @@ -744,6 +744,9 @@ int32_t WelsDecodeMbCabacPSliceBaseMode0 (PWelsDecoderContext pCtx, PWelsNeighAv int32_t iQpDelta, iId8x8, iId4x4; WELS_READ_VERIFY (ParseDeltaQpCabac (pCtx, iQpDelta)); + if (iQpDelta > 25 || iQpDelta < -26) { //out of iQpDelta range + return ERR_INFO_INVALID_QP; + } pCurLayer->pLumaQp[iMbXy] = (pSlice->iLastMbQp + iQpDelta + 52) % 52; //update last_mb_qp pSlice->iLastMbQp = pCurLayer->pLumaQp[iMbXy]; pCurLayer->pChromaQp[iMbXy] = g_kuiChromaQpTable[WELS_CLIP3 (pSlice->iLastMbQp + diff --git a/codec/decoder/core/src/manage_dec_ref.cpp b/codec/decoder/core/src/manage_dec_ref.cpp index 34d9ab72..285bf0b7 100644 --- a/codec/decoder/core/src/manage_dec_ref.cpp +++ b/codec/decoder/core/src/manage_dec_ref.cpp @@ -119,6 +119,8 @@ int32_t WelsInitRefList (PWelsDecoderContext pCtx, int32_t iPoc) { if (pRef != NULL) { // IDR lost, set new pRef->bIsComplete = false; // Set complete flag to false for lost IDR ref picture + pRef->iSpsId = pCtx->pSps->iSpsId; + pRef->iPpsId = pCtx->pPps->iPpsId; pCtx->iErrorCode |= dsDataErrorConcealed; bool bCopyPrevious = ((ERROR_CON_FRAME_COPY_CROSS_IDR == pCtx->eErrorConMethod) || (ERROR_CON_SLICE_COPY_CROSS_IDR == pCtx->eErrorConMethod) @@ -260,8 +262,8 @@ int32_t WelsMarkAsRef (PWelsDecoderContext pCtx) { pCtx->pDec->uiQualityId = pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.uiQualityId; pCtx->pDec->uiTemporalId = pCtx->pCurDqLayer->sLayerInfo.sNalHeaderExt.uiTemporalId; - pCtx->pDec->iSpsId = pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iSpsId; - pCtx->pDec->iPpsId = pCtx->pCurDqLayer->sLayerInfo.sSliceInLayer.sSliceHeaderExt.sSliceHeader.iPpsId; + pCtx->pDec->iSpsId = pCtx->pSps->iSpsId; + pCtx->pDec->iPpsId = pCtx->pPps->iPpsId; for (j = pCurAU->uiStartPos; j <= pCurAU->uiEndPos; j++) { if (pCurAU->pNalUnitsList[j]->sNalHeaderExt.sNalUnitHeader.eNalUnitType == NAL_UNIT_CODED_SLICE_IDR