From e7cfc1f5bd0c37aabb3f420c5da75a314ffcd7c1 Mon Sep 17 00:00:00 2001 From: ekwange Date: Tue, 30 May 2023 17:52:34 +0900 Subject: [PATCH] v4l2: Change to query only up to V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS Fix to prevent infinite querying. There are devices that exceed V4L2_CID_PRIVATE_BASE+V4L2_CID_MAX_CTRLS but do not return EINVAL. Part-of: --- subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c b/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c index 66bcef004d..e207c51a3c 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c +++ b/subprojects/gst-plugins-good/sys/v4l2/v4l2_calls.c @@ -307,6 +307,10 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) } else { GST_WARNING_OBJECT (e, "Failed querying control %d on device '%s'. " "(%d - %s)", n, v4l2object->videodev, errno, strerror (errno)); + if (n > (V4L2_CID_PRIVATE_BASE + V4L2_CID_MAX_CTRLS)) { + GST_DEBUG_OBJECT (e, "Finish control by reaching V4L2_CID_MAX_CTRLS"); + break; + } continue; } }