diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index 042364f160..d24023f932 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -345,9 +345,13 @@ gst_audio_info_from_caps (GstAudioInfo * info, const GstCaps * caps) gst_audio_info_set_format (info, format, rate, channels); pos_val_arr = gst_structure_get_value (str, "channel-positions"); + if (pos_val_arr) { guint max_pos = MIN (channels, 64); + if (channels != gst_value_array_get_size (pos_val_arr)) + goto incoherent_channels; + for (i = 0; i < max_pos; i++) { pos_val_entry = gst_value_array_get_value (pos_val_arr, i); info->position[i] = g_value_get_enum (pos_val_entry); @@ -385,6 +389,13 @@ no_channels: GST_ERROR ("no channels property given"); return FALSE; } + +incoherent_channels: + { + GST_ERROR ("There should be %d channels positions, but %d are present", + channels, gst_value_array_get_size (pos_val_arr)); + return FALSE; + } } /**