mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
basesrc: avoid trying to alloc enormous buffer
If a class extending basesrc doesn't set blocksize, basesrc would try to allocate a (guint)-1 sized buffer, which is enormous and likely would fail. Avoid it and error out.
This commit is contained in:
parent
1cb205b30f
commit
59319194b8
1 changed files with 5 additions and 1 deletions
|
@ -1284,12 +1284,16 @@ gst_base_src_default_alloc (GstBaseSrc * src, guint64 offset,
|
|||
|
||||
if (priv->pool) {
|
||||
ret = gst_buffer_pool_acquire_buffer (priv->pool, buffer, NULL);
|
||||
} else {
|
||||
} else if (size != -1) {
|
||||
*buffer = gst_buffer_new_allocate (priv->allocator, size, priv->alignment);
|
||||
if (G_UNLIKELY (*buffer == NULL))
|
||||
goto alloc_failed;
|
||||
|
||||
ret = GST_FLOW_OK;
|
||||
} else {
|
||||
GST_WARNING_OBJECT (src, "Not trying to alloc %u bytes. Blocksize not set?",
|
||||
size);
|
||||
goto alloc_failed;
|
||||
}
|
||||
return ret;
|
||||
|
||||
|
|
Loading…
Reference in a new issue