We would always copy sizeof(sorted_position) bytes, which is
for 8 channels, but if we have less than 8 channels the
position array we copy from will only have allocated space
for channel channels, so we would read beyond the input
array in some cases.
GST_AUDIO_CHANNEL_POSITION_INVALID) {
const GstAudioChannelPosition *position;
GstAudioChannelPosition sorted_position[8];
+ guint c;
position = channel_positions[channels - 1];
dec->lpcm_layout = position;
- memcpy (sorted_position, position, sizeof (sorted_position));
+ for (c = 0; c < channels; ++c)
+ sorted_position[c] = position[c];
gst_audio_channel_positions_to_valid_order (sorted_position, channels);
gst_audio_info_set_format (&dec->info, format, rate, channels,
sorted_position);