Commit a8151d78 authored by duhui.lee's avatar duhui.lee Committed by Sebastian Dröge

h265parser: Fix segfault when parsing VPS

https://bugzilla.gnome.org/show_bug.cgi?id=722081
parent e8d569f5
...@@ -1714,12 +1714,12 @@ gst_h265_parse_vps (GstH265NalUnit * nalu, GstH265VPS * vps) ...@@ -1714,12 +1714,12 @@ gst_h265_parse_vps (GstH265NalUnit * nalu, GstH265VPS * vps)
G_MAXUINT32 - 1); G_MAXUINT32 - 1);
} }
/* setting default values if vps->sub_layer_ordering_info_present_flag is zero */ /* setting default values if vps->sub_layer_ordering_info_present_flag is zero */
if (!vps->sub_layer_ordering_info_present_flag) { if (!vps->sub_layer_ordering_info_present_flag && vps->max_sub_layers_minus1) {
for (i = 0; i <= (vps->max_sub_layers_minus1 - 1); i++) { for (i = 0; i <= (vps->max_sub_layers_minus1 - 1); i++) {
vps->max_dec_pic_buffering_minus1[i] = vps->max_dec_pic_buffering_minus1[i] =
vps->max_dec_pic_buffering_minus1[vps->max_sub_layers_minus1]; vps->max_dec_pic_buffering_minus1[vps->max_sub_layers_minus1];
vps->max_dec_pic_buffering_minus1[i] = vps->max_num_reorder_pics[i] =
vps->max_dec_pic_buffering_minus1[vps->max_sub_layers_minus1]; vps->max_num_reorder_pics[vps->max_sub_layers_minus1];
vps->max_latency_increase_plus1[i] = vps->max_latency_increase_plus1[i] =
vps->max_latency_increase_plus1[vps->max_sub_layers_minus1]; vps->max_latency_increase_plus1[vps->max_sub_layers_minus1];
} }
...@@ -1881,12 +1881,12 @@ gst_h265_parse_sps (GstH265Parser * parser, GstH265NalUnit * nalu, ...@@ -1881,12 +1881,12 @@ gst_h265_parse_sps (GstH265Parser * parser, GstH265NalUnit * nalu,
G_MAXUINT32 - 1); G_MAXUINT32 - 1);
} }
/* setting default values if sps->sub_layer_ordering_info_present_flag is zero */ /* setting default values if sps->sub_layer_ordering_info_present_flag is zero */
if (!sps->sub_layer_ordering_info_present_flag) { if (!sps->sub_layer_ordering_info_present_flag && sps->max_sub_layers_minus1) {
for (i = 0; i <= (sps->max_sub_layers_minus1 - 1); i++) { for (i = 0; i <= (sps->max_sub_layers_minus1 - 1); i++) {
sps->max_dec_pic_buffering_minus1[i] = sps->max_dec_pic_buffering_minus1[i] =
sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1]; sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1];
sps->max_dec_pic_buffering_minus1[i] = sps->max_num_reorder_pics[i] =
sps->max_dec_pic_buffering_minus1[sps->max_sub_layers_minus1]; sps->max_num_reorder_pics[sps->max_sub_layers_minus1];
sps->max_latency_increase_plus1[i] = sps->max_latency_increase_plus1[i] =
sps->max_latency_increase_plus1[sps->max_sub_layers_minus1]; sps->max_latency_increase_plus1[sps->max_sub_layers_minus1];
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_H265_MAX_SUB_LAYERS 8
#define GST_H265_MAX_VPS_COUNT 16 #define GST_H265_MAX_VPS_COUNT 16
#define GST_H265_MAX_SPS_COUNT 16 #define GST_H265_MAX_SPS_COUNT 16
#define GST_H265_MAX_PPS_COUNT 64 #define GST_H265_MAX_PPS_COUNT 64
...@@ -463,9 +464,9 @@ struct _GstH265VPS { ...@@ -463,9 +464,9 @@ struct _GstH265VPS {
GstH265ProfileTierLevel profile_tier_level; GstH265ProfileTierLevel profile_tier_level;
guint8 sub_layer_ordering_info_present_flag; guint8 sub_layer_ordering_info_present_flag;
guint8 max_dec_pic_buffering_minus1[7]; guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
guint8 max_num_reorder_pics[7]; guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
guint32 max_latency_increase_plus1[7]; guint32 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
guint8 max_layer_id; guint8 max_layer_id;
guint16 num_layer_sets_minus1; guint16 num_layer_sets_minus1;
...@@ -703,9 +704,9 @@ struct _GstH265SPS ...@@ -703,9 +704,9 @@ struct _GstH265SPS
guint8 log2_max_pic_order_cnt_lsb_minus4; guint8 log2_max_pic_order_cnt_lsb_minus4;
guint8 sub_layer_ordering_info_present_flag; guint8 sub_layer_ordering_info_present_flag;
guint8 max_dec_pic_buffering_minus1[7]; guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
guint8 max_num_reorder_pics[7]; guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
guint8 max_latency_increase_plus1[7]; guint8 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
guint8 log2_min_luma_coding_block_size_minus3; guint8 log2_min_luma_coding_block_size_minus3;
guint8 log2_diff_max_min_luma_coding_block_size; guint8 log2_diff_max_min_luma_coding_block_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment