From 76cc5f88c5ffe5df691a368719a6ecd0a4447cd9 Mon Sep 17 00:00:00 2001 From: "U. Artie Eoff" Date: Wed, 27 Jul 2022 08:45:45 -0400 Subject: [PATCH] vaapi: h265dec: avoid possible NULL deref Check "pi" before attempting to dereference it. Captured by static analysis. Part-of: --- .../gst-libs/gst/vaapi/gstvaapidecoder_h265.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c index 5da849035a..167058f431 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidecoder_h265.c @@ -218,7 +218,7 @@ struct _GstVaapiPictureH265 GstVaapiPicture base; GstH265SliceHdr *last_slice_hdr; guint structure; - gint32 poc; // PicOrderCntVal (8.3.1) + gint32 poc; // PicOrderCntVal (8.3.1) gint32 poc_lsb; // slice_pic_order_cnt_lsb guint32 pic_latency_cnt; // PicLatencyCount guint output_flag:1; @@ -587,8 +587,10 @@ ensure_pps (GstVaapiDecoderH265 * decoder, GstH265PPS * pps) gst_vaapi_parser_info_h265_replace (&priv->active_pps, pi); /* Ensure our copy is up-to-date */ - pi->data.pps = *pps; - pi->data.pps.sps = NULL; + if (pi) { + pi->data.pps = *pps; + pi->data.pps.sps = NULL; + } return pi ? &pi->data.pps : NULL; } @@ -615,7 +617,8 @@ ensure_sps (GstVaapiDecoderH265 * decoder, GstH265SPS * sps) pi->state |= (priv->active_sps->state & GST_H265_VIDEO_STATE_GOT_I_FRAME); /* Ensure our copy is up-to-date */ - pi->data.sps = *sps; + if (pi) + pi->data.sps = *sps; gst_vaapi_parser_info_h265_replace (&priv->active_sps, pi); return pi ? &pi->data.sps : NULL;