mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
bufferlist: Add check for overflow
This commit is contained in:
parent
5318a03888
commit
1e9dcac0fb
1 changed files with 3 additions and 0 deletions
|
@ -436,6 +436,9 @@ gst_buffer_list_insert (GstBufferList * list, gint idx, GstBuffer * buffer)
|
||||||
want_alloc = list->n_buffers + 1;
|
want_alloc = list->n_buffers + 1;
|
||||||
|
|
||||||
if (want_alloc > list->n_allocated) {
|
if (want_alloc > list->n_allocated) {
|
||||||
|
if (G_UNLIKELY (list->n_allocated > (G_MAXUINT / 2)))
|
||||||
|
g_error ("Growing GstBufferList would result in overflow");
|
||||||
|
|
||||||
want_alloc = MAX (GST_ROUND_UP_16 (want_alloc), list->n_allocated * 2);
|
want_alloc = MAX (GST_ROUND_UP_16 (want_alloc), list->n_allocated * 2);
|
||||||
|
|
||||||
if (GST_BUFFER_LIST_IS_USING_DYNAMIC_ARRAY (list)) {
|
if (GST_BUFFER_LIST_IS_USING_DYNAMIC_ARRAY (list)) {
|
||||||
|
|
Loading…
Reference in a new issue