kmsagnosticbin: fix possible out of bounds access in gstreamer
The function gst_caps_get_size() checks for valid index, but the check
is bugy because it allows that index == size.
Callers of gst_caps_set_features() should use an already valid index.
@@ -493,7 +493,7 @@ check_bin (KmsTreeBin * tree_bin, const GstCaps * caps)
GST_DEBUG_OBJECT (tree_bin, "TreeBin '%" GST_PTR_FORMAT "' caps: %"
GST_PTR_FORMAT, tree_bin, current_caps);
- if (current_caps != NULL) {
+ if (current_caps != NULL && gst_caps_get_size (current_caps) > 0) {
//TODO: Remove this when problem in negotiation with features will be
//resolved
GstCaps *caps_without_features = gst_caps_make_writable (current_caps);
