diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2014-11-11 13:26:55 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-01-13 00:16:42 +0100 |
commit | 431f57f0467244686ae63a3d06a8cf51f60090ed (patch) | |
tree | 7029b1a5ee665c2a4baed272238a0dd9b185d026 /libavcodec | |
parent | 88411b87b4bb3c5820ec232f26ba4a284c11a7f9 (diff) | |
download | ffmpeg-431f57f0467244686ae63a3d06a8cf51f60090ed.tar.gz |
libopusenc: prevent an out-of-bounds read by returning early
CC: libav-stable@libav.org
Bug-Id: CID 1244188
(cherry picked from commit 8dd0a2c5cf40a8a49faae985adc11750b6429132)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libopusenc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c index 9af8bcda7e..8f754668c9 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 + |