Skip to content

[Coverity 1666289] Dereference after null check in vaapi/filters.c

Either the check against null is unnecessary, or there may be a null pointer dereference.

In Open: Pointer is checked against null but then dereferenced anyway (CWE-476)

      1. Condition filter->vctx_in == NULL, taking true branch.
      2. var_compare_op: Comparing filter->vctx_in to null implies that filter->vctx_in might be null.
293    if (filter->vctx_in == NULL ||
294        vlc_video_context_GetType(filter->vctx_in) != VLC_VIDEO_CONTEXT_VAAPI)
      3. Condition !vlc_vaapi_IsChromaOpaque(filter->fmt_out.video.i_chroma), taking false branch.
      4. Condition !video_format_IsSimilar(&filter->fmt_out.video, &filter->fmt_in.video), taking false branch.
295    if (!vlc_vaapi_IsChromaOpaque(filter->fmt_out.video.i_chroma) ||
296        !video_format_IsSimilar(&filter->fmt_out.video, &filter->fmt_in.video))
297        return VLC_EGENERIC;
298
299    filter_sys = calloc(1, sizeof(*filter_sys));
      5. Condition !filter_sys, taking false branch.
300    if (!filter_sys)
301        return VLC_ENOMEM;
302    filter->p_sys = filter_sys;
303
304    filter_sys->p_data = p_data;
305
306    filter_sys->va.conf = VA_INVALID_ID;
307    filter_sys->va.ctx = VA_INVALID_ID;
308    filter_sys->va.buf = VA_INVALID_ID;
     
CID 1666289: (#1 of 1): Dereference after null check (FORWARD_NULL)
6. var_deref_model: Passing null pointer filter->vctx_in to vlc_video_context_HoldDevice, which dereferences it.[show details]
309    filter_sys->va.dec_device = vlc_video_context_HoldDevice(filter->vctx_in);
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information