aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-14 23:16:07 +0100
committerMax Kellermann <max@duempel.org>2014-01-15 11:25:58 +0100
commit5b6bb114add8f4aac9a9434cd723e5062ae2461f (patch)
tree26ab0dc4e7200412dd59a235743cf7f355f7de55 /src/decoder
parent56f082c9d46eefda3057b962d15dac50d25b690d (diff)
downloadmpd-5b6bb114add8f4aac9a9434cd723e5062ae2461f.tar.gz
mpd-5b6bb114add8f4aac9a9434cd723e5062ae2461f.tar.xz
mpd-5b6bb114add8f4aac9a9434cd723e5062ae2461f.zip
decoder/ffmpeg: check for av_samples_get_buffer_size() errors
Fixes potential nullptr dereference.
Diffstat (limited to 'src/decoder')
-rw-r--r--src/decoder/FfmpegDecoderPlugin.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx
index 47e1a3384..c99ecebe3 100644
--- a/src/decoder/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/FfmpegDecoderPlugin.cxx
@@ -223,6 +223,9 @@ copy_interleave_frame(const AVCodecContext *codec_context,
codec_context->channels,
frame->nb_samples,
codec_context->sample_fmt, 1);
+ if (data_size <= 0)
+ return data_size;
+
if (av_sample_fmt_is_planar(codec_context->sample_fmt) &&
codec_context->channels > 1) {
if(*global_buffer_size < data_size) {