shithub: openh264

Download patch

ref: 3c08f04993e7f73073de88554ed6227067fa7783
parent: 030d320e43c7f2b5b65931ab52160ef1486fd52b
author: Sijia Chen <[email protected]>
date: Wed Dec 17 09:14:23 EST 2014

add fix for protection of wrong reading if input is invalid

--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -550,7 +550,8 @@
            pParam->iLoopFilterDisableIdc
           );
   int32_t i = 0;
-  while (i < pParam->iSpatialLayerNum) {
+  int32_t iSpatialLayers = (pParam->iSpatialLayerNum < MAX_SPATIAL_LAYER_NUM)?(pParam->iSpatialLayerNum):MAX_SPATIAL_LAYER_NUM;
+  while (i < iSpatialLayers) {
     SSpatialLayerConfig* pSpatialCfg = &pParam->sSpatialLayers[i];
     WelsLog (&m_pWelsTrace->m_sLogCtx, WELS_LOG_INFO,
              "sSpatialLayers[%d]: .iVideoWidth= %d; .iVideoHeight= %d; .fFrameRate= %.6ff; .iSpatialBitrate= %d; .iMaxSpatialBitrate= %d; .sSliceCfg.uiSliceMode= %d; .sSliceCfg.sSliceArgument.iSliceNum= %d; .sSliceCfg.sSliceArgument.uiSliceSizeConstraint= %d;\