From: Sebastian Dröge Date: Thu, 2 Apr 2020 10:45:48 +0000 (+0300) Subject: pad: Add a guard against getrange functions not filling a caller-provided buffer X-Git-Tag: 1.19.3~946 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=606a9acd74f91160a4668e70ebe6acdcfb7128ab;p=platform%2Fupstream%2Fgstreamer.git 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. --- 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;