h265decoder: Prevent possible infinite loop

Theoretically, one could produce a broken stream that would lead to
infinite in the specified algorithm to calculate l0/l1 reference lists.
This patch will pearly exit if this condition is met.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1750>
This commit is contained in:
Nicolas Dufresne 2020-11-01 18:30:34 -05:00 committed by GStreamer Merge Bot
parent 2e2e93c303
commit e3fb5f894f

View file

@ -376,6 +376,14 @@ gst_h265_decoder_process_ref_pic_lists (GstH265Decoder * self,
if (GST_H265_IS_I_SLICE (&slice->header))
return;
/* Inifinit loop prevention */
if (self->NumPocStCurrBefore == 0 && self->NumPocStCurrAfter == 0 &&
self->NumPocLtCurr == 0 && !scc_ext->pps_curr_pic_ref_enabled_flag) {
GST_WARNING_OBJECT (self,
"Expected references, got none, preventing infinit loop.");
return;
}
/* 8.3.4 Deriving l0 */
tmp_refs = priv->ref_pic_list_tmp;