Commit 520dda09 authored by Nicolas Dufresne's avatar Nicolas Dufresne
Browse files

v4l2object: Validate returned dimensions

https://bugzilla.gnome.org/show_bug.cgi?id=720568
parent 61ce7b1a
......@@ -2919,6 +2919,9 @@ gst_v4l2_object_setup_format (GstV4l2Object * v4l2object,
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FMT, &fmt) < 0)
goto get_fmt_failed;
if (fmt.fmt.pix.width == 0 || fmt.fmt.pix.height == 0)
goto invalid_dimensions;
fmtdesc = gst_v4l2_object_get_format_from_fourcc (v4l2object,
fmt.fmt.pix.pixelformat);
if (fmtdesc == NULL)
......@@ -2968,6 +2971,14 @@ get_fmt_failed:
(_("Video device did not provide output format.")), GST_ERROR_SYSTEM);
return FALSE;
}
invalid_dimensions:
{
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS,
(_("Video device returned invalid dimensions.")),
("Expected non 0 dimensions, got %dx%d", fmt.fmt.pix.width,
fmt.fmt.pix.height));
return FALSE;
}
unsupported_field:
{
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment