summaryrefslogtreecommitdiff
path: root/libavformat/ape.c
diff options
context:
space:
mode:
authorKostya <kostya.shishkov@gmail.com>2011-03-15 09:19:43 +0000
committerReinhard Tartler <siretart@tauware.de>2011-03-16 12:53:52 +0100
commit8312e3fc9041027a33c8bc667bb99740fdf41dd5 (patch)
treec94c3b3aa28fe2c7c86aa1ee8b019ac139b3681f /libavformat/ape.c
parent1dac4d554734b16757b36a0adc71642c5ef2c4e6 (diff)
Do not attempt to decode APE file with no frames
This fixes invalid reads/writes with this sample: http://packetstorm.linuxsecurity.com/1103-exploits/vlc105-dos.txt
Diffstat (limited to 'libavformat/ape.c')
-rw-r--r--libavformat/ape.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 6c269849fd..dd2aeb9ff3 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -242,6 +242,10 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
avio_seek(pb, ape->wavheaderlength, SEEK_CUR);
}
+ if(!ape->totalframes){
+ av_log(s, AV_LOG_ERROR, "No frames in the file!\n");
+ return AVERROR(EINVAL);
+ }
if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
return -1;