Don't allow negative sizes when allocating new buffers.

Original commit message from CVS:
* gst/gstpad.c: (gst_pad_alloc_buffer_full):
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_prepare_output_buffer):
Don't allow negative sizes when allocating new buffers.
Fixes bug #461253.
This commit is contained in:
Sebastian Dröge 2008-05-06 08:43:57 +00:00
parent e0a92a0604
commit e9e0d0f0eb
4 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2008-05-06 Sebastian Dröge <slomo@circular-chaos.org>
* gst/gstpad.c: (gst_pad_alloc_buffer_full):
* libs/gst/base/gstbasetransform.c:
(gst_base_transform_prepare_output_buffer):
Don't allow negative sizes when allocating new buffers.
Fixes bug #461253.
2008-05-05 Tim-Philipp Müller <tim.muller at collabora co uk>
Patch by: Sjoerd Simons <sjoerd at luon net>

2
common

@ -1 +1 @@
Subproject commit f6fc3fa7643c03eb912f4e259d48c99b0e8d0aca
Subproject commit 9b28214399156457fd6b43d0604a47e4bdf19c28

View file

@ -2711,6 +2711,7 @@ fallback:
}
}
/* FIXME 0.11: size should be unsigned */
static GstFlowReturn
gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, gint size,
GstCaps * caps, GstBuffer ** buf, gboolean setcaps)
@ -2722,6 +2723,7 @@ gst_pad_alloc_buffer_full (GstPad * pad, guint64 offset, gint size,
g_return_val_if_fail (GST_IS_PAD (pad), GST_FLOW_ERROR);
g_return_val_if_fail (GST_PAD_IS_SRC (pad), GST_FLOW_ERROR);
g_return_val_if_fail (buf != NULL, GST_FLOW_ERROR);
g_return_val_if_fail (size >= 0, GST_FLOW_ERROR);
GST_DEBUG_OBJECT (pad, "offset %" G_GUINT64_FORMAT ", size %d", offset, size);
@ -2816,6 +2818,8 @@ not_negotiated:
*
* MT safe.
*/
/* FIXME 0.11: size should be unsigned */
GstFlowReturn
gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
GstBuffer ** buf)
@ -2843,6 +2847,8 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
*
* MT safe.
*/
/* FIXME 0.11: size should be unsigned */
GstFlowReturn
gst_pad_alloc_buffer_and_set_caps (GstPad * pad, guint64 offset, gint size,
GstCaps * caps, GstBuffer ** buf)

View file

@ -884,6 +884,8 @@ failed_configure:
* inbuf, the caller should be prepared for this and perform
* appropriate refcounting.
*/
/* FIXME 0.11: out_size should be unsigned */
static GstFlowReturn
gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
GstBuffer * in_buf, gint out_size, GstCaps * out_caps, GstBuffer ** out_buf)
@ -892,6 +894,8 @@ gst_base_transform_prepare_output_buffer (GstBaseTransform * trans,
GstFlowReturn ret = GST_FLOW_OK;
gboolean copy_inbuf = FALSE;
g_return_val_if_fail (out_size >= 0, GST_FLOW_ERROR);
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
/* we cannot reconfigure the element yet as we are still processing