From 606a9acd74f91160a4668e70ebe6acdcfb7128ab Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 2 Apr 2020 13:45:48 +0300 Subject: [PATCH] pad: Add a guard against getrange functions not filling a caller-provided buffer It's a programming error to not do so and would cause all kinds of problems in the caller that assumed its own buffer to have been filled. --- gst/gstpad.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst/gstpad.c b/gst/gstpad.c index 456bf37..0d43108 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -4878,6 +4878,10 @@ probed_data: GST_PAD_STREAM_UNLOCK (pad); + /* If the caller provided a buffer it must be filled by the getrange + * function instead of it returning a new buffer */ + g_return_val_if_fail (!*buffer || res_buf == *buffer, GST_FLOW_ERROR); + *buffer = res_buf; return ret; -- 2.7.4