shithub: openh264

Download patch

ref: c89a6911a02ec3f4364a50908afcbf863887ea61
parent: be43cf888f62bae1a3f1e251e680a52ec3f1d62d
parent: a9fd78f1e2d22529415473b012de2e937c57a8d7
author: huili2 <[email protected]>
date: Tue Feb 25 11:56:33 EST 2014

Merge pull request #355 from licaiguo/check-sliceheader

add a check to parseSliceHeaderSyntaxes

--- a/codec/decoder/core/src/decoder_core.cpp
+++ b/codec/decoder/core/src/decoder_core.cpp
@@ -473,6 +473,7 @@
 #define SLICE_HEADER_ALPHAC0_BETA_OFFSET_MAX 12
 #define SLICE_HEADER_INTER_LAYER_ALPHAC0_BETA_OFFSET_MIN -12
 #define SLICE_HEADER_INTER_LAYER_ALPHAC0_BETA_OFFSET_MAX 12
+#define MAX_NUM_REF_IDX_L0_ACTIVE_MINUS1 15
 /*
  *	decode_slice_header_avc
  *	Parse slice header of bitstream in avc for storing data structure
@@ -673,6 +674,8 @@
     pSliceHead->bNumRefIdxActiveOverrideFlag	= !!uiCode;
     if (pSliceHead->bNumRefIdxActiveOverrideFlag) {
       WELS_READ_VERIFY (BsGetUe (pBs, &uiCode)); //num_ref_idx_l0_active_minus1
+      WELS_CHECK_SE_UPPER_ERROR (uiCode, MAX_NUM_REF_IDX_L0_ACTIVE_MINUS1, "num_ref_idx_l0_active_minus1",
+                                 GENERATE_ERROR_NO (ERR_LEVEL_SLICE_HEADER, ERR_INFO_INVALID_NUM_REF_IDX_L0_ACTIVE_MINUS1));
       pSliceHead->uiRefCount[0]	= 1 + uiCode;
     }
   }