aboutsummaryrefslogtreecommitdiffstats
path: root/src/decoder/FfmpegDecoderPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-14 23:16:07 +0100
committerMax Kellermann <max@duempel.org>2014-01-14 23:16:07 +0100
commitf1ca17f6a1a8a04016ceb31e799cc0504729322b (patch)
tree17a479168bb738b457d181ee7b46946522052dd6 /src/decoder/FfmpegDecoderPlugin.cxx
parentfe7cda57e46aa133cf84abc76308388bbf091cbb (diff)
downloadmpd-f1ca17f6a1a8a04016ceb31e799cc0504729322b.tar.gz
mpd-f1ca17f6a1a8a04016ceb31e799cc0504729322b.tar.xz
mpd-f1ca17f6a1a8a04016ceb31e799cc0504729322b.zip
decoder/ffmpeg: check for av_samples_get_buffer_size() errors
Fixes potential nullptr dereference.
Diffstat (limited to '')
-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 705a97abf..7b827da27 100644
--- a/src/decoder/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/FfmpegDecoderPlugin.cxx
@@ -222,6 +222,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) {