mlpdec: do not try to allocate a zero-sized output buffer.
authorAnton Khirnov <anton@khirnov.net>
Thu, 14 Feb 2013 13:05:35 +0000 (14:05 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sat, 23 Feb 2013 12:05:31 +0000 (13:05 +0100)
CC:libav-stable@libav.org

libavcodec/mlpdec.c

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