audio: Fix overread in channel positions

The array we're writing to is limited to 64 ... but the amount of
input positions might be lower than 64. Therefore use MIN and not
MAX to know how many values to read from the array.
This commit is contained in:
Edward Hervey 2011-10-05 11:51:07 +02:00
parent 1261c08a2f
commit 70d967da7c

View file

@ -346,7 +346,8 @@ gst_audio_info_from_caps (GstAudioInfo * info, const GstCaps * caps)
pos_val_arr = gst_structure_get_value (str, "channel-positions");
if (pos_val_arr) {
guint max_pos = MAX (channels, 64);
guint max_pos = MIN (channels, 64);
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);