summaryrefslogtreecommitdiff
path: root/libavcodec/libopusenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-13 12:12:16 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-13 12:12:27 +0100
commit7b824e8b25cb9442ce8769ded59200aa0deab35c (patch)
tree7ae83c2caea5351ac8f5b64fedb9852f2ea7c7c1 /libavcodec/libopusenc.c
parent3c6e148e843e97a6c7d9dff937b0371bf1e37ff3 (diff)
parent8dd0a2c5cf40a8a49faae985adc11750b6429132 (diff)
Merge commit '8dd0a2c5cf40a8a49faae985adc11750b6429132'
* commit '8dd0a2c5cf40a8a49faae985adc11750b6429132': libopusenc: prevent an out-of-bounds read by returning early Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libopusenc.c')
-rw-r--r--libavcodec/libopusenc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 6fbb99b970..6bb48628ab 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -170,10 +170,11 @@ static av_cold int libopus_encode_init(AVCodecContext *avctx)
/* FIXME: Opus can handle up to 255 channels. However, the mapping for
* anything greater than 8 is undefined. */
- if (avctx->channels > 8)
- av_log(avctx, AV_LOG_WARNING,
+ if (avctx->channels > 8) {
+ av_log(avctx, AV_LOG_ERROR,
"Channel layout undefined for %d channels.\n", avctx->channels);
-
+ return AVERROR_PATCHWELCOME;
+ }
if (!avctx->bit_rate) {
/* Sane default copied from opusenc */
avctx->bit_rate = 64000 * opus->stream_count +