mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
ext/: Use gst_buffer_try_new_and_alloc() and fail properly if the allocation failed. This prevents abort() if downstr...
Original commit message from CVS: * ext/gio/gstgiobasesrc.c: (gst_gio_base_src_create): * ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create): Use gst_buffer_try_new_and_alloc() and fail properly if the allocation failed. This prevents abort() if downstream elements request an insane amount of memory.
This commit is contained in:
parent
0bdeaae59e
commit
79bb2ffe06
3 changed files with 18 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-11-24 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
|
||||||
|
* ext/gio/gstgiobasesrc.c: (gst_gio_base_src_create):
|
||||||
|
* ext/gnomevfs/gstgnomevfssrc.c: (gst_gnome_vfs_src_create):
|
||||||
|
Use gst_buffer_try_new_and_alloc() and fail properly if the
|
||||||
|
allocation failed. This prevents abort() if downstream elements
|
||||||
|
request an insane amount of memory.
|
||||||
|
|
||||||
2008-11-24 Wim Taymans <wim.taymans@collabora.co.uk>
|
2008-11-24 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
* gst/volume/gstvolume.c: (volume_choose_func),
|
* gst/volume/gstvolume.c: (volume_choose_func),
|
||||||
|
|
|
@ -317,9 +317,7 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
|
||||||
GstBuffer ** buf_return)
|
GstBuffer ** buf_return)
|
||||||
{
|
{
|
||||||
GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
|
GstGioBaseSrc *src = GST_GIO_BASE_SRC (base_src);
|
||||||
|
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
|
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
|
||||||
g_return_val_if_fail (G_IS_INPUT_STREAM (src->stream), GST_FLOW_ERROR);
|
g_return_val_if_fail (G_IS_INPUT_STREAM (src->stream), GST_FLOW_ERROR);
|
||||||
|
@ -369,7 +367,11 @@ gst_gio_base_src_create (GstBaseSrc * base_src, guint64 offset, guint size,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
src->cache = gst_buffer_new_and_alloc (cachesize);
|
src->cache = gst_buffer_try_new_and_alloc (cachesize);
|
||||||
|
if (G_UNLIKELY (src->cache == NULL)) {
|
||||||
|
GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", cachesize);
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (src, "Reading %u bytes from offset %" G_GUINT64_FORMAT,
|
GST_LOG_OBJECT (src, "Reading %u bytes from offset %" G_GUINT64_FORMAT,
|
||||||
cachesize, offset);
|
cachesize, offset);
|
||||||
|
|
|
@ -625,7 +625,11 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = gst_buffer_new_and_alloc (size);
|
buf = gst_buffer_try_new_and_alloc (size);
|
||||||
|
if (G_UNLIKELY (buf == NULL && size == 0)) {
|
||||||
|
GST_ERROR_OBJECT (src, "Failed to allocate %u bytes", size);
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
data = GST_BUFFER_DATA (buf);
|
data = GST_BUFFER_DATA (buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue