ref: b230a6deee7c7381fcecf1fb17f6ca5b10438aa1
parent: d3dc48d1d108b1944fd1a94f955c787534e8b4bd
parent: 3596b6ced0368f62d1860946a6d3a9a0220a68b7
author: ruil2 <ruil2@cisco.com>
date: Tue Aug 19 12:47:36 EDT 2014
Merge pull request #1285 from dongzha/TestRandomEnc avoid encoder crash with random pixel input
--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -2965,6 +2965,9 @@
* \return EFrameType (videoFrameTypeIDR/videoFrameTypeI/videoFrameTypeP)
*/
int32_t WelsEncoderEncodeExt (sWelsEncCtx* pCtx, SFrameBSInfo* pFbi, const SSourcePicture* pSrcPic) {
+ if( pCtx == NULL ) {
+ return ENC_RETURN_MEMALLOCERR;
+ }
SLayerBSInfo* pLayerBsInfo = &pFbi->sLayerInfo[0];
SWelsSvcCodingParam* pSvcParam = pCtx->pSvcParam;
SSpatialPicIndex* pSpatialIndexMap = &pCtx->sSpatialIndexMap[0];