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@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-02-28 07:19:37 +01:00
parent e3822886eb
commit 8b1cd25ca7
1 changed files with 4 additions and 0 deletions

View File

@ -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;