[FFmpeg-cvslog] pmpdec: Check for zero audio packets.

Michael Niedermayer git at videolan.org
Tue Feb 28 07:36:44 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Feb 28 07:19:37 2012 +0100| [8b1cd25ca7e64e6128fa2902d78e48bfeeec9786] | committer: Michael Niedermayer

pmpdec: Check for zero audio packets.

This fixes a division by 0.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/pmpdec.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
index 4ef8ca3..315e58c 100644
--- a/libavformat/pmpdec.c
+++ b/libavformat/pmpdec.c
@@ -124,6 +124,10 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt)
     if (pmp->cur_stream == 0) {
         int num_packets;
         pmp->audio_packets = avio_r8(pb);
+        if (!pmp->audio_packets) {
+            av_log_ask_for_sample(s, "0 audio packets\n");
+            return AVERROR_PATCHWELCOME;
+        }
         num_packets = (pmp->num_streams - 1) * pmp->audio_packets + 1;
         avio_skip(pb, 8);
         pmp->current_packet = 0;



More information about the ffmpeg-cvslog mailing list