History

Merge pull request #2644 from huili2/parseonly_add_protection

make error consistence for memory fail

huili2 committed 9 years ago

Commit e1a27c92 parents 10bc74b 4c74cc86 files · +56 −35Browse files

Showing the changes to codec/decoder/core/src/au_parser.cpp (1 of 6 files). Show all

Unified · Split

codec/decoder/core/src/au_parser.cpp+7−2
@@ -1148,7 +1148,9 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 1147 unmodified lines
11481148
11491149 if (pCtx->pParam->bParseOnly) {
11501150 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //sps bs exceeds!
1151− pCtx->iErrorCode |= dsOutOfMemory;
1151+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "sps payload size (%d) too large for parse only (%d), not supported!",
1152+ kSrcNalLen, SPS_PPS_BS_SIZE - 4);
1153+ pCtx->iErrorCode |= dsBitstreamError;
11521154 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);
11531155 }
11541156 if (!kbUseSubsetFlag) { //SPS
@@ -1181,6 +1183,7 @@ int32_t ParseSps (PWelsDecoderContext pCtx, PBitStringAux pBsAux, int32_t* pPicW · 26 unmodified lines
11811183 uint8_t* pBsBuf = static_cast<uint8_t*> (pMa->WelsMallocz (SPS_PPS_BS_SIZE + 4,
11821184 "Temp buffer for parse only usage.")); //to reserve 4 bytes for UVLC writing buffer
11831185 if (NULL == pBsBuf) {
1186+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_ERROR, "sps buffer alloc failed for parse only!");
11841187 pCtx->iErrorCode |= dsOutOfMemory;
11851188 return pCtx->iErrorCode;
11861189 }
@@ -1448,7 +1451,9 @@ int32_t ParsePps (PWelsDecoderContext pCtx, PPps pPpsList, PBitStringAux pBsAux, · 261 unmodified lines
14481451 }
14491452 if (pCtx->pParam->bParseOnly) {
14501453 if (kSrcNalLen >= SPS_PPS_BS_SIZE - 4) { //pps bs exceeds
1451− pCtx->iErrorCode |= dsOutOfMemory;
1454+ WelsLog (& (pCtx->sLogCtx), WELS_LOG_WARNING, "pps payload size (%d) too large for parse only (%d), not supported!",
1455+ kSrcNalLen, SPS_PPS_BS_SIZE - 4);
1456+ pCtx->iErrorCode |= dsBitstreamError;
14521457 return GENERATE_ERROR_NO (ERR_LEVEL_PARAM_SETS, ERR_INFO_OUT_OF_MEMORY);
14531458 }
14541459 SPpsBsInfo* pPpsBs = &pCtx->sPpsBsInfo [uiPpsId];

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