opusdec: prevent 'channels=0' in caps
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>
Mon, 27 Apr 2020 07:40:23 +0000 (09:40 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.com>
Mon, 27 Apr 2020 08:07:33 +0000 (10:07 +0200)
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>

gst-libs/gst/pbutils/codec-utils.c

index 152434e..cf35e77 100644 (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