shithub: openh264

Download patch

ref: 11e0fc837681a20e57a6ce3d5d5d77cfcca83da0
parent: 87c73073918c0b5c2dd6305e3d24eff649062a5d
parent: 040079277815d56f74a249d9c9b83e1de5944b2d
author: huili2 <huili2@cisco.com>
date: Mon Jul 27 10:19:42 EDT 2015

Merge pull request #2051 from huili2/sh_check_slice_type

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;