From 03cdd32b33d2c79add7c96bc19a7620d5a5ad611 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 23 Nov 2011 17:38:24 +0100 Subject: [PATCH] bufferlist: avoid reading past the array When the foreach function told us to remove the buffer from the list, decrease the length of the array or else we might read past the last item in the array. --- gst/gstbufferlist.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gst/gstbufferlist.c b/gst/gstbufferlist.c index cc5ddf2..803545b 100644 --- a/gst/gstbufferlist.c +++ b/gst/gstbufferlist.c @@ -210,6 +210,7 @@ gst_buffer_list_foreach (GstBufferList * list, GstBufferListFunc func, if (buf != buf_ret) { if (buf_ret == NULL) { g_array_remove_index (list->array, i); + len--; } else { g_array_index (list->array, GstBuffer *, i) = buf_ret; } -- 2.7.4