aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-17 03:17:56 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-01-17 20:08:29 +0100
commita129622390fca8a298c3b121f42b2d15910b9b22 (patch)
tree190d4c4a06a93d6bec1903f506e64bd4791fd3b0 /libavcodec/utils.c
parentaf5004b557562dd767844c4aacc2c189dba05eef (diff)
downloadffmpeg-a129622390fca8a298c3b121f42b2d15910b9b22.tar.gz
lavc: Check CODEC_CAP_VARIABLE_FRAME_SIZE && !frame
This combination is quite odd and almost certainly a bug if it happens. Reviewed-by: Justin Ruggles <justin.ruggles@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 22a7ee3666..657eb5b932 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -968,6 +968,8 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
if (!user_packet) {
if (avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) {
av_assert0(av_get_bits_per_sample(avctx->codec_id) != 0);
+ if (!frame)
+ return AVERROR(EINVAL);
buf_size = nb_samples * avctx->channels *
av_get_bits_per_sample(avctx->codec_id) / 8;
} else {