Commit a339f8f9 authored by Sebastian Dröge's avatar Sebastian Dröge 🍵 Committed by Tim-Philipp Müller
Browse files

avcodecmap: Don't try converting channel layouts with more than 64 channels

We only support up to 64 channels in GStreamer with a specific layout so
it's safe to assume a NONE layout in this case.

Also the arrays of channel positions are allocated everywhere with 64
elements so don't try setting more than 64 to NONE as that will cause
stack corruptions and similar memory safety issues.

Thanks to Natalie Silvanovich for reporting this issue.

Fixes #92

Part-of: <!121>
parent aacec2cf
Pipeline #284309 waiting for manual action with stages
in 49 seconds
This commit is part of merge request !121. Comments created here will be created in the context of that merge request.
......@@ -102,7 +102,7 @@ gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
guint nchannels = 0;
gboolean none_layout = FALSE;
if (channel_layout == 0) {
if (channel_layout == 0 || channels > 64) {
nchannels = channels;
none_layout = TRUE;
} else {
......@@ -163,7 +163,7 @@ gst_ffmpeg_channel_layout_to_gst (guint64 channel_layout, gint channels,
} else {
guint i;
for (i = 0; i < nchannels; i++)
for (i = 0; i < nchannels && i < 64; i++)
pos[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment