From c1e03081c06a08b8e330168f2a9db9a0e08c9bf8 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 5 Sep 2023 16:56:44 -0400 Subject: [PATCH] v4l2: object: Handle video helper return value gst_video_info_set_interlaced_format() can return an error if the width/height causes integer overflow. Handle this case, so that we can fail cleanly. This has been experienced while testing an in-progress driver. Part-of: --- subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c index fe9006cf3d..d6a85d774d 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c @@ -4052,7 +4052,7 @@ gst_v4l2_object_set_format_full (GstV4l2Object * v4l2object, GstCaps * caps, /* Passing HDR10 information * - * TODO: + * TODO: * - Missing capture (v4l2src) HDR10 configuration and/or reporting * - The API is not capable of HDR to HDR conversion as controls are not specific to queues */ @@ -4580,8 +4580,9 @@ gst_v4l2_object_acquire_format (GstV4l2Object * v4l2object, GstVideoInfo * info) goto unsupported_field; } - gst_video_info_set_interlaced_format (info, format, interlace_mode, width, - height); + if (!gst_video_info_set_interlaced_format (info, format, interlace_mode, + width, height)) + goto invalid_dimensions; gst_v4l2_object_get_colorspace (v4l2object, &fmt, &info->colorimetry); gst_v4l2_object_get_streamparm (v4l2object, info);