From 0bae0f869a1f2aa11dc75fedac5bb36a94a87d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 28 Nov 2014 13:06:41 +0200 Subject: [PATCH] Validate that iLoopFilterDisableIdc is set to a sensible value in ParamValidationExt In WelsEncoderParamAdjust it is already clipped in the same way, but here we should probably rather error out than to silently clip it to the right range. --- codec/encoder/core/src/encoder_ext.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/codec/encoder/core/src/encoder_ext.cpp b/codec/encoder/core/src/encoder_ext.cpp index d16290ef..a3e1a960 100644 --- a/codec/encoder/core/src/encoder_ext.cpp +++ b/codec/encoder/core/src/encoder_ext.cpp @@ -261,6 +261,12 @@ int32_t ParamValidationExt (SLogContext* pLogCtx, SWelsSvcCodingParam* pCodingPa pCodingParam->uiIntraPeriod, pCodingParam->uiGopSize); return ENC_RETURN_UNSUPPORTED_PARA; } + if (pCodingParam->iLoopFilterDisableIdc < 0 || pCodingParam->iLoopFilterDisableIdc > 6) { + WelsLog (pLogCtx, WELS_LOG_ERROR, + "ParamValidationExt(), iLoopFilterDisableIdc(%d) must be between 0 and 6", + pCodingParam->iLoopFilterDisableIdc); + return ENC_RETURN_UNSUPPORTED_PARA; + } //about iMultipleThreadIdc, bDeblockingParallelFlag, iLoopFilterDisableIdc, & uiSliceMode