From 70d967da7c41cc5e79aa72c5c41a13cf05c2d31f Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 5 Oct 2011 11:51:07 +0200 Subject: [PATCH] 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. --- gst-libs/gst/audio/audio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c index 49a4878970..042364f160 100644 --- a/gst-libs/gst/audio/audio.c +++ b/gst-libs/gst/audio/audio.c @@ -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);