ref: 3596b6ced0368f62d1860946a6d3a9a0220a68b7
parent: d3dc48d1d108b1944fd1a94f955c787534e8b4bd
author: dongzha <[email protected]>
date: Tue Aug 19 11:36:27 EDT 2014
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];