v4l2object: Validate returned dimensions
https://bugzilla.gnome.org/show_bug.cgi?id=720568
This commit is contained in:
parent
61ce7b1a62
commit
520dda092a
@ -2919,6 +2919,9 @@ gst_v4l2_object_setup_format (GstV4l2Object * v4l2object,
|
|||||||
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FMT, &fmt) < 0)
|
if (v4l2_ioctl (v4l2object->video_fd, VIDIOC_G_FMT, &fmt) < 0)
|
||||||
goto get_fmt_failed;
|
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,
|
fmtdesc = gst_v4l2_object_get_format_from_fourcc (v4l2object,
|
||||||
fmt.fmt.pix.pixelformat);
|
fmt.fmt.pix.pixelformat);
|
||||||
if (fmtdesc == NULL)
|
if (fmtdesc == NULL)
|
||||||
@ -2968,6 +2971,14 @@ get_fmt_failed:
|
|||||||
(_("Video device did not provide output format.")), GST_ERROR_SYSTEM);
|
(_("Video device did not provide output format.")), GST_ERROR_SYSTEM);
|
||||||
return FALSE;
|
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:
|
unsupported_field:
|
||||||
{
|
{
|
||||||
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
|
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user