mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-08-02 11:45:07 +00:00
ximagsink: do not access uninitialized height variable.
Exit like in xvimagesink, if we have partial caps.
This commit is contained in:
parent
ea2e208cc1
commit
bc4388c413
|
@ -1659,6 +1659,7 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
|
||||||
GstCaps *alloc_caps;
|
GstCaps *alloc_caps;
|
||||||
gboolean alloc_unref = FALSE;
|
gboolean alloc_unref = FALSE;
|
||||||
gint width, height;
|
gint width, height;
|
||||||
|
GstVideoRectangle dst, src, result;
|
||||||
|
|
||||||
ximagesink = GST_XIMAGESINK (bsink);
|
ximagesink = GST_XIMAGESINK (bsink);
|
||||||
|
|
||||||
|
@ -1674,10 +1675,13 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
|
||||||
|
|
||||||
/* get struct to see what is requested */
|
/* get struct to see what is requested */
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
|
if (!gst_structure_get_int (structure, "width", &width) ||
|
||||||
if (gst_structure_get_int (structure, "width", &width) &&
|
!gst_structure_get_int (structure, "height", &height)) {
|
||||||
gst_structure_get_int (structure, "height", &height)) {
|
GST_WARNING_OBJECT (ximagesink, "invalid caps for buffer allocation %"
|
||||||
GstVideoRectangle dst, src, result;
|
GST_PTR_FORMAT, caps);
|
||||||
|
ret = GST_FLOW_UNEXPECTED;
|
||||||
|
goto beach;
|
||||||
|
}
|
||||||
|
|
||||||
src.w = width;
|
src.w = width;
|
||||||
src.h = height;
|
src.h = height;
|
||||||
|
@ -1757,7 +1761,6 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
|
||||||
* width and height variables */
|
* width and height variables */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
alloc:
|
alloc:
|
||||||
/* Inspect our buffer pool */
|
/* Inspect our buffer pool */
|
||||||
|
@ -1799,6 +1802,7 @@ alloc:
|
||||||
|
|
||||||
*buf = GST_BUFFER_CAST (ximage);
|
*buf = GST_BUFFER_CAST (ximage);
|
||||||
|
|
||||||
|
beach:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue