ref: 13db7fea7b45dd87b4d6cd9c68837964a3cbfdb2
parent: f5eb6d4fdc5716fb411515bb86cbd26938d929e5
author: huili2 <[email protected]>
date: Tue Apr 22 18:43:40 EDT 2014
prevent from return if ref_idx is error
--- a/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
+++ b/codec/decoder/core/src/parse_mb_syn_cavlc.cpp
@@ -1003,7 +1003,12 @@
// 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 @@
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 @@
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 @@
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] =