prevent from return if ref_idx is error

This commit is contained in:
huili2 2014-04-22 22:43:40 -07:00
parent f5eb6d4fdc
commit 13db7fea7b

View File

@ -1003,7 +1003,12 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
// Security check: iRefIdx should be in range 0 to num_ref_idx_l0_active_minus1, includsive
// ref to standard section 7.4.5.1. iRefCount[0] is 1 + num_ref_idx_l0_active_minus1.
if ((iRefIdx < 0) || (iRefIdx >= iRefCount[0]) || (ppRefPic[iRefIdx] == NULL)) { //error ref_idx
return ERR_INFO_INVALID_REF_INDEX;
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return ERR_INFO_INVALID_REF_INDEX;
}
}
} else {
WelsLog (pCtx, WELS_LOG_WARNING, "inter parse: iMotionPredFlag = 1 not supported. \n");
@ -1036,7 +1041,12 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
return ERR_INFO_INVALID_REF_INDEX;
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return ERR_INFO_INVALID_REF_INDEX;
}
}
}
for (i = 0; i < 2; i++) {
@ -1065,7 +1075,12 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
return ERR_INFO_INVALID_REF_INDEX;
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return ERR_INFO_INVALID_REF_INDEX;
}
}
} else {
WelsLog (pCtx, WELS_LOG_WARNING, "inter parse: iMotionPredFlag = 1 not supported. \n");
@ -1126,7 +1141,12 @@ int32_t ParseInterInfo (PWelsDecoderContext pCtx, int16_t iMvArray[LIST_A][30][M
WELS_READ_VERIFY (BsGetTe0 (pBs, iRefCount[0], &uiCode)); //ref_idx_l0[ mbPartIdx ]
iRefIdx[i] = uiCode;
if ((iRefIdx[i] < 0) || (iRefIdx[i] >= iRefCount[0]) || (ppRefPic[iRefIdx[i]] == NULL)) { //error ref_idx
return ERR_INFO_INVALID_REF_INDEX;
if (pCtx->iErrorConMethod != ERROR_CON_DISABLE) {
iRefIdx[i] = 0;
pCtx->iErrorCode |= dsBitstreamError;
} else {
return ERR_INFO_INVALID_REF_INDEX;
}
}
pCurDqLayer->pRefIndex[0][iMbXy][uiScan4Idx ] = pCurDqLayer->pRefIndex[0][iMbXy][uiScan4Idx + 1] =