aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libopusenc.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2014-11-11 13:26:55 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2014-11-13 01:41:25 +0100
commit8dd0a2c5cf40a8a49faae985adc11750b6429132 (patch)
tree0842c0d49ab56c2c5f5c4cd80f55e9c4f84b0740 /libavcodec/libopusenc.c
parentb09cf8afc5199d359ac985ad7cea72a6a9f20e4e (diff)
downloadffmpeg-8dd0a2c5cf40a8a49faae985adc11750b6429132.tar.gz
libopusenc: prevent an out-of-bounds read by returning early
CC: libav-stable@libav.org Bug-Id: CID 1244188
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 84472068ed..da6194acac 100644
--- a/libavcodec/libopusenc.c
+++ b/libavcodec/libopusenc.c
@@ -163,10 +163,11 @@ static int av_cold 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 +