[FFmpeg-cvslog] lavf/pcm: check size, do not produce invalid packets

Paul B Mahol git at videolan.org
Fri Dec 7 14:09:10 CET 2012


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Dec  7 13:05:43 2012 +0000| [8ca8b43d7108b9d7e6887fd553d13a71afa670c6] | committer: Paul B Mahol

lavf/pcm: check size, do not produce invalid packets

Inspired by 92b8c9d89e7ae86bffa05393bb230d5a165b0148.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8ca8b43d7108b9d7e6887fd553d13a71afa670c6
---

 libavformat/pcm.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index 71f6a4f..2fe44dc 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -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);
 



More information about the ffmpeg-cvslog mailing list