v4l2: Fix use after free of fmtdesc
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 12 Apr 2023 21:18:13 +0000 (17:18 -0400)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Fri, 14 Apr 2023 15:16:06 +0000 (15:16 +0000)
commit76c5eb4654a657cc65d9f0bb77e7d343fd20ada6
treea4d503f0f9f6097b519d4e186da3b474ae0a4431
parent85e679ce1afb325d7046759f4d9474cb9f17c72c
v4l2: Fix use after free of fmtdesc

The decoder needs to force another enumeration of the format. For
this it was clearing the v4l2object insternal list, leaving a fmtdesc
pointer pointing to freed memory. This patch clears the fmtdesc pointer
that has just been free. It also makes sure the probe function does not
use the cached formats list. The probe function will restore the current
fmtdesc pointer based on the currently configured pixelformat.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4426>
subprojects/gst-plugins-good/sys/v4l2/gstv4l2videodec.c