From 75cd9a62f4af4d4fa46e0818269efeb88b9c9938 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 16 Aug 2012 16:59:42 +0200 Subject: [PATCH] libvpxenc: check for odd RC parameter combinations that could crash Signed-off-by: Michael Niedermayer --- libavcodec/libvpxenc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 7046802076..0b979072bb 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -242,6 +242,13 @@ static av_cold int vp8_init(AVCodecContext *avctx) vpx_codec_err_to_string(res)); return AVERROR(EINVAL); } + + if(!avctx->bit_rate) + if(avctx->rc_max_rate || avctx->rc_buffer_size || avctx->rc_initial_buffer_occupancy) { + av_log( avctx, AV_LOG_ERROR, "Rate control parameters set without a bitrate\n"); + return AVERROR(EINVAL); + } + dump_enc_cfg(avctx, &enccfg); enccfg.g_w = avctx->width;