History

Merge pull request #384 from licaiguo/check-spsid-ppsid

add checks for spsid and ppsid

volvet committed 12 years ago

Commit aa043fa2 parents a3f129d ba312b03 files · +23 −11Browse files

Unified · Split

3 files
  1. codec/decoder/core/inc/error_code.h +2 −0
  2. codec/decoder/core/src/au_parser.cpp +9 −10
  3. codec/decoder/core/src/decoder_core.cpp +12 −1
codec/decoder/core/inc/error_code.h+2−0
@@ -126,6 +126,8 @@ enum { · 125 unmodified lines
126126 ERR_INFO_INVALID_NUM_REF_FRAME_IN_PIC_ORDER_CNT_CYCLE,
127127 ERR_INFO_INVALID_DBLOCKING_IDC,
128128 ERR_INFO_INVALID_MB_TYPE,
129+ ERR_INFO_INVALID_SPS_ID,
130+ ERR_INFO_INVALID_PPS_ID,
129131 ERR_INFO_INVALID_SUB_MB_TYPE,
130132 ERR_INFO_UNAVAILABLE_TOP_BLOCK_FOR_INTRA,
131133 ERR_INFO_UNAVAILABLE_LEFT_BLOCK_FOR_INTRA,
codec/decoder/core/src/au_parser.cpp+9−10
@@ -783,12 +783,6 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 782 unmodified lines
783783 pCtx->bSubspsExistAheadFlag = true;
784784 } else { // Sps
785785 pCtx->bSpsExistAheadFlag = true;
786−
787− // added for EC, 10/28/2009
788− // for safe
789− memset (&pCtx->bSpsAvailFlags[0], 0, sizeof (pCtx->bSpsAvailFlags));
790− memset (&pCtx->bSubspsAvailFlags[0], 0, sizeof (pCtx->bSubspsAvailFlags));
791− memset (&pCtx->bPpsAvailFlags[0], 0, sizeof (pCtx->bPpsAvailFlags));
792786 }
793787
794788 WELS_READ_VERIFY (BsGetBits (pBs, 8, &uiCode)); //profile_idc
@@ -818,10 +812,10 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 23 unmodified lines
818812 if (kbUseSubsetFlag) {
819813 pSubsetSps = &pCtx->sSubsetSpsBuffer[iSpsId];
820814 pSps = &pSubsetSps->sSps;
821− pCtx->bSubspsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009
815+ pCtx->bSubspsAvailFlags[iSpsId] = false;
822816 } else {
823817 pSps = &pCtx->sSpsBuffer[iSpsId];
824− pCtx->bSpsAvailFlags[iSpsId] = true; // added for EC, 10/28/2009
818+ pCtx->bSpsAvailFlags[iSpsId] = false;
825819 }
826820 const SLevelLimits* pSLevelLimits = GetLevelLimits (uiLevelIdc, bConstraintSetFlags[3]);
827821 if (NULL == pSLevelLimits) {
@@ -1000,7 +994,11 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 172 unmodified lines
1000994
1001995 *pPicWidth = pSps->iMbWidth << 4;
1002996 *pPicHeight = pSps->iMbHeight << 4;
1003−
997+ if (kbUseSubsetFlag) {
998+ pCtx->bSubspsAvailFlags[iSpsId] = true;
999+ } else {
1000+ pCtx->bSpsAvailFlags[iSpsId] = true;
1001+ }
10041002 return 0;
10051003 }
10061004
@@ -1032,6 +1030,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 25 unmodified lines
10321030 return ERR_INFO_PPS_ID_OVERFLOW;
10331031 }
10341032
1033+ pCtx->bPpsAvailFlags[uiPpsId] = false;
10351034 pPps = &pPpsList[uiPpsId];
10361035
10371036 pPps->iPpsId = uiPpsId;
@@ -1114,7 +1113,7 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux) · 76 unmodified lines
11141113 WELS_READ_VERIFY (BsGetOneBit (pBsAux, &uiCode)); //redundant_pic_cnt_present_flag
11151114 pPps->bRedundantPicCntPresentFlag = !!uiCode;
11161115
1117− pCtx->bPpsAvailFlags[uiPpsId] = true; // added for EC, 10/28/2009
1116+ pCtx->bPpsAvailFlags[uiPpsId] = true;
11181117
11191118 return ERR_NONE;
11201119 }
codec/decoder/core/src/decoder_core.cpp+12−1
@@ -459,6 +459,10 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 458 unmodified lines
459459 }
460460
461461 //add check PPS available here
462+ if (pCtx->bPpsAvailFlags[iPpsId] == false) {
463+ WelsLog (pCtx, WELS_LOG_ERROR, "PPS id is invalid!\n");
464+ return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_PPS_ID);
465+ }
462466
463467 pPps = &pCtx->sPpsBuffer[iPpsId];
464468
@@ -473,11 +477,18 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co · 8 unmodified lines
473477 }
474478
475479 //add check SPS available here
476−
477480 if (kbExtensionFlag) {
478481 pSubsetSps = &pCtx->sSubsetSpsBuffer[pPps->iSpsId];
479482 pSps = &pSubsetSps->sSps;
483+ if (pCtx->bSubspsAvailFlags[pPps->iSpsId] == false) {
484+ WelsLog (pCtx, WELS_LOG_ERROR, "SPS id is invalid!\n");
485+ return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
486+ }
480487 } else {
488+ if (pCtx->bSpsAvailFlags[pPps->iSpsId] == false) {
489+ WelsLog (pCtx, WELS_LOG_ERROR, "SPS id is invalid!\n");
490+ return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SPS_ID);
491+ }
481492 pSps = &pCtx->sSpsBuffer[pPps->iSpsId];
482493 }
483494 pCtx->pSps = pSps;

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