Properly handle a bad stream_id in OPUS_MULTISTREAM_GET_*_STATE_REQUEST master
authorJean-Marc Valin <jmvalin@jmvalin.ca>
Wed, 23 Jan 2019 18:47:40 +0000 (13:47 -0500)
committerJean-Marc Valin <jmvalin@jmvalin.ca>
Wed, 23 Jan 2019 18:48:31 +0000 (13:48 -0500)
Thanks to Dmitriy for reporting this.

src/opus_multistream_decoder.c
src/opus_multistream_encoder.c

index 562103c..0018517 100644 (file)
@@ -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)
           {
index 9cb9bf3..93204a1 100644 (file)
@@ -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)
       {