Browse Source

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

CC: libav-stable@libav.org
Bug-Id: CID 1244188
tags/n2.5
Vittorio Giovara 11 years ago
parent
commit
8dd0a2c5cf
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      libavcodec/libopusenc.c

+ 4
- 3
libavcodec/libopusenc.c View File

@@ -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 /* FIXME: Opus can handle up to 255 channels. However, the mapping for
* anything greater than 8 is undefined. */ * 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); "Channel layout undefined for %d channels.\n", avctx->channels);

return AVERROR_PATCHWELCOME;
}
if (!avctx->bit_rate) { if (!avctx->bit_rate) {
/* Sane default copied from opusenc */ /* Sane default copied from opusenc */
avctx->bit_rate = 64000 * opus->stream_count + avctx->bit_rate = 64000 * opus->stream_count +


Loading…
Cancel
Save