From 9f2a0c70d40442f3f05a575c4ea3e9eb1051a195 Mon Sep 17 00:00:00 2001
From: Jean-Marc Valin <jmvalin@jmvalin.ca>
Date: Wed, 23 Jan 2019 13:47:40 -0500
Subject: [PATCH] Properly handle a bad stream_id in
 OPUS_MULTISTREAM_GET_*_STATE_REQUEST

Thanks to Dmitriy for reporting this.
---
 src/opus_multistream_decoder.c | 2 +-
 src/opus_multistream_encoder.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/opus_multistream_decoder.c b/src/opus_multistream_decoder.c
index 562103cd0..0018517ae 100644
--- a/src/opus_multistream_decoder.c
+++ b/src/opus_multistream_decoder.c
@@ -487,7 +487,7 @@ int opus_multistream_decoder_ctl_va_list(OpusMSDecoder *st, int request,
           OpusDecoder **value;
           stream_id = va_arg(ap, opus_int32);
           if (stream_id<0 || stream_id >= st->layout.nb_streams)
-             ret = OPUS_BAD_ARG;
+             goto bad_arg;
           value = va_arg(ap, OpusDecoder**);
           if (!value)
           {
diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c
index 9cb9bf345..93204a14c 100644
--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -1249,7 +1249,7 @@ int opus_multistream_encoder_ctl_va_list(OpusMSEncoder *st, int request,
       OpusEncoder **value;
       stream_id = va_arg(ap, opus_int32);
       if (stream_id<0 || stream_id >= st->layout.nb_streams)
-         ret = OPUS_BAD_ARG;
+         goto bad_arg;
       value = va_arg(ap, OpusEncoder**);
       if (!value)
       {
-- 
GitLab