shithub: openh264

Download patch

ref: 040079277815d56f74a249d9c9b83e1de5944b2d
parent: 87c73073918c0b5c2dd6305e3d24eff649062a5d
author: huili2 <huili2@cisco.com>
date: Mon Jul 27 06:11:46 EDT 2015

add slice_type check for num_ref_frame

--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -791,6 +791,13 @@
 
   pSliceHeadExt->pSubsetSps = pSubsetSps;
 
+  if (pSps->iNumRefFrames == 0) {
+    if ((uiSliceType != I_SLICE) && (uiSliceType != SI_SLICE)) {
+      WelsLog (pLogCtx, WELS_LOG_WARNING, "slice_type (%d) not supported for num_ref_frames = 0.", uiSliceType);
+      return GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_SLICE_TYPE);
+    }
+  }
+
   bIdrFlag = (!kbExtensionFlag && eNalType == NAL_UNIT_CODED_SLICE_IDR) || (kbExtensionFlag && pNalHeaderExt->bIdrFlag);
   pSliceHead->bIdrFlag = bIdrFlag;