decoder/ffmpeg: check for av_samples_get_buffer_size() errors

Fixes potential nullptr dereference.
This commit is contained in:
Max Kellermann 2014-01-14 23:16:07 +01:00
parent fe7cda57e4
commit f1ca17f6a1
1 changed files with 3 additions and 0 deletions

View File

@ -222,6 +222,9 @@ copy_interleave_frame(const AVCodecContext *codec_context,
codec_context->channels, codec_context->channels,
frame->nb_samples, frame->nb_samples,
codec_context->sample_fmt, 1); codec_context->sample_fmt, 1);
if (data_size <= 0)
return data_size;
if (av_sample_fmt_is_planar(codec_context->sample_fmt) && if (av_sample_fmt_is_planar(codec_context->sample_fmt) &&
codec_context->channels > 1) { codec_context->channels > 1) {
if(*global_buffer_size < data_size) { if(*global_buffer_size < data_size) {