[FFmpeg-cvslog] libopusenc: prevent an out-of-bounds read by returning early

Vittorio Giovara git at videolan.org
Thu Nov 13 12:52:03 CET 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Tue Nov 11 13:26:55 2014 +0100| [8dd0a2c5cf40a8a49faae985adc11750b6429132] | committer: Vittorio Giovara

libopusenc: prevent an out-of-bounds read by returning early

CC: libav-stable at libav.org
Bug-Id: CID 1244188

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8dd0a2c5cf40a8a49faae985adc11750b6429132
---

 libavcodec/libopusenc.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavcodec/libopusenc.c b/libavcodec/libopusenc.c
index 8447206..da6194a 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 +



More information about the ffmpeg-cvslog mailing list