Permalink
Browse files

Merge pull request #1648 from huili2/bugfix_cabacinitidc

add check for cabac_init_idc range in parsing
  • Loading branch information...
HaiboZhu committed Dec 18, 2014
2 parents ab480fe + 9f0ed3f commit 7f27198c6857096d755b592c7f55f7b1469c50ab
Showing with 4 additions and 0 deletions.
  1. +1 −0 codec/decoder/core/inc/error_code.h
  2. +3 −0 codec/decoder/core/src/decoder_core.cpp
@@ -117,6 +117,7 @@ ERR_INFO_INVALID_SLICE_ALPHA_C0_OFFSET_DIV2,
ERR_INFO_INVALID_SLICE_BETA_OFFSET_DIV2,
ERR_INFO_FMO_INIT_FAIL,
ERR_INFO_SLICE_TYPE_OVERFLOW,
ERR_INFO_INVALID_CABAC_INIT_IDC,
ERR_INFO_INVALID_QP,
ERR_INFO_INVALID_PIC_INIT_QS,
ERR_INFO_INVALID_CHROMA_QP_INDEX_OFFSET,
@@ -469,6 +469,7 @@ void DecodeNalHeaderExt (PNalUnit pNal, uint8_t* pSrc) {
#define SLICE_HEADER_INTER_LAYER_ALPHAC0_BETA_OFFSET_MIN -12
#define SLICE_HEADER_INTER_LAYER_ALPHAC0_BETA_OFFSET_MAX 12
#define MAX_NUM_REF_IDX_L0_ACTIVE_MINUS1 15
#define SLICE_HEADER_CABAC_INIT_IDC_MAX 2
/*
* decode_slice_header_avc
* Parse slice header of bitstream in avc for storing data structure
@@ -729,6 +730,8 @@ int32_t ParseSliceHeaderSyntaxs (PWelsDecoderContext pCtx, PBitStringAux pBs, co
if (pSliceHead->eSliceType != I_SLICE && pSliceHead->eSliceType != SI_SLICE) {
WELS_READ_VERIFY (BsGetUe (pBs, &uiCode));
pSliceHead->iCabacInitIdc = uiCode;
WELS_CHECK_SE_UPPER_ERROR (pSliceHead->iCabacInitIdc, SLICE_HEADER_CABAC_INIT_IDC_MAX, "cabac_init_idc",
ERR_INFO_INVALID_CABAC_INIT_IDC);
} else
pSliceHead->iCabacInitIdc = 0;
}

0 comments on commit 7f27198

Please sign in to comment.