summaryrefslogtreecommitdiff
path: root/libavformat/pmpdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-11-28 10:54:35 +0100
committerAnton Khirnov <anton@khirnov.net>2014-01-03 16:40:22 +0100
commit1b5d065ca722eb8028c7a08e054b6da3419faf5d (patch)
treeddf927b29f7e0ca6fce04cbec76d7c648898d516 /libavformat/pmpdec.c
parent94a417acc05cc5151b473abc0bf51fad26f8c5a0 (diff)
pmpdec: check that there is at least one audio packet.
The code cannot handle there being none, but that should not happen for valid files. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind CC:libav-stable@libav.org
Diffstat (limited to 'libavformat/pmpdec.c')
-rw-r--r--libavformat/pmpdec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
index 484be43ce9..8ae147f391 100644
--- a/libavformat/pmpdec.c
+++ b/libavformat/pmpdec.c
@@ -124,6 +124,11 @@ 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(s, AV_LOG_ERROR, "No audio packets.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
num_packets = (pmp->num_streams - 1) * pmp->audio_packets + 1;
avio_skip(pb, 8);
pmp->current_packet = 0;