mlpdec: do not try to allocate a zero-sized output buffer.

CC:libav-stable@libav.org
(cherry picked from commit 0dff40bfb9)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
This commit is contained in:
Anton Khirnov
2013-02-14 14:05:35 +01:00
committed by Reinhard Tartler
parent 48fd461977
commit e2cf32ca5f

View File

@@ -978,6 +978,11 @@ static int output_data(MLPDecodeContext *m, unsigned int substr,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (!s->blockpos) {
av_log(avctx, AV_LOG_ERROR, "No samples to output.\n");
return AVERROR_INVALIDDATA;
}
/* get output buffer */ /* get output buffer */
m->frame.nb_samples = s->blockpos; m->frame.nb_samples = s->blockpos;
if ((ret = ff_get_buffer(avctx, &m->frame)) < 0) { if ((ret = ff_get_buffer(avctx, &m->frame)) < 0) {