opusdec: prevent 'channels=0' in caps

gst_opus_channel_positions() should fail if caps contains "channels=0".
Prevent index underflow when indexing gst_opus_channel_positions[] (CID 1462590).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/644>
This commit is contained in:
Guillaume Desmottes 2020-04-27 09:40:23 +02:00
parent 6a1e575345
commit 4610bb59ac

View file

@ -1613,7 +1613,7 @@ gst_codec_utils_opus_parse_caps (GstCaps * caps,
if (channel_mapping_family)
*channel_mapping_family = f;
if (!gst_structure_get_int (s, "channels", &c)) {
if (!gst_structure_get_int (s, "channels", &c) || c == 0) {
if (f == 0)
c = 2;
else