bufferlist: avoid reading past the array
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 23 Nov 2011 16:38:24 +0000 (17:38 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 23 Nov 2011 17:05:00 +0000 (18:05 +0100)
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

index cc5ddf2..803545b 100644 (file)
@@ -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;
       }