lavf/pcm: check size, do not produce invalid packets
authorPaul B Mahol <onemda@gmail.com>
Fri, 7 Dec 2012 13:05:43 +0000 (13:05 +0000)
committerPaul B Mahol <onemda@gmail.com>
Fri, 7 Dec 2012 13:05:43 +0000 (13:05 +0000)
Inspired by 92b8c9d89e7ae86bffa05393bb230d5a165b0148.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavformat/pcm.c

index 71f6a4f..2fe44dc 100644 (file)
@@ -30,6 +30,8 @@ int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret, size;
 
     size= RAW_SAMPLES*s->streams[0]->codec->block_align;
+    if (size <= 0)
+        return AVERROR(EINVAL);
 
     ret= av_get_packet(s->pb, pkt, size);