From 748c5f357938156923c3379428dfabf619f0e97a Mon Sep 17 00:00:00 2001 From: Rouven Czerwinski Date: Wed, 2 Feb 2022 12:49:29 +0100 Subject: [PATCH] gstv4l2tuner: return NULL if no norm set If the video4linux device supports norms but has no norm set, norm is returned as an uninitialized variable after the ioctl call, leading to gst_v4l2_tuner_get_norm_by_std_id() returning a random norm from the supported norms. Catch this case and instead return NULL to indicate that no norm is setup. Part-of: --- subprojects/gst-plugins-good/sys/v4l2/gstv4l2tuner.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2tuner.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2tuner.c index c08b2ca..d70f9c2 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2tuner.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2tuner.c @@ -181,7 +181,8 @@ gst_v4l2_tuner_get_norm (GstV4l2Object * v4l2object) /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2object), NULL); - gst_v4l2_get_norm (v4l2object, &norm); + if (!gst_v4l2_get_norm (v4l2object, &norm)) + return NULL; return gst_v4l2_tuner_get_norm_by_std_id (v4l2object, norm); } -- 2.7.4