summaryrefslogtreecommitdiff
path: root/libavcodec/libvpxenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-16 16:59:42 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-16 17:00:32 +0200
commit75cd9a62f4af4d4fa46e0818269efeb88b9c9938 (patch)
tree7e5fd5c095c22e9f206b81ea45d5c7b7601bfe21 /libavcodec/libvpxenc.c
parentd472453efd32bfb0b3cd348183f4fcb7d4df4389 (diff)
libvpxenc: check for odd RC parameter combinations that could crash
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r--libavcodec/libvpxenc.c7
1 files changed, 7 insertions, 0 deletions
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;