From dd4bbb63792d3c75aa041dfa81d3f31c4c288ad4 Mon Sep 17 00:00:00 2001 From: Matthew Waters Date: Mon, 4 Jul 2022 17:27:50 +1000 Subject: [PATCH] videoconvertscale: ensure writable caps when fixating format gst_video_convert_scale_get_fixed_format() receives 'othercaps' from basetransforms' fixate_caps() vmethod which explicitly mentions that '`othercaps` may not be writable'. The gst_caps_intersect() call just before may or may not produce new caps. Particularly in cases like EMPTY or ANY caps on either of the inputs, only a ref is taken and returned to the caller. As a result, gst_video_convert_scale_fixate_format() may have attempted to modify a non-writable caps structure. Fix by adding a gst_caps_make_writable(). Part-of: --- .../gst-plugins-base/gst/videoconvertscale/gstvideoconvertscale.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subprojects/gst-plugins-base/gst/videoconvertscale/gstvideoconvertscale.c b/subprojects/gst-plugins-base/gst/videoconvertscale/gstvideoconvertscale.c index fabc63c..7c10252 100644 --- a/subprojects/gst-plugins-base/gst/videoconvertscale/gstvideoconvertscale.c +++ b/subprojects/gst-plugins-base/gst/videoconvertscale/gstvideoconvertscale.c @@ -1249,6 +1249,7 @@ gst_video_convert_scale_get_fixed_format (GstBaseTransform * trans, result = gst_caps_copy (othercaps); } + result = gst_caps_make_writable (result); gst_video_convert_scale_fixate_format (trans, caps, result); /* fixate remaining fields */ -- 2.7.4