aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-07-24 23:51:11 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2021-02-02 14:18:20 +0100
commitc017516140aa06bcacd4351eab13b022d8e5f49a (patch)
tree495582243a78ddb1dd7ad0238568b60d483d5e28
parent1498f31b5b7733c19a0091f67930f54c8047dddd (diff)
downloadffmpeg-c017516140aa06bcacd4351eab13b022d8e5f49a.tar.gz
avformat/ape: Error out in case of EOF in the header
Fixes: OOM Fixes: 24375/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6216862443241472 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit a6df1fd5e96c012ba477a56b3858a310e243b921) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/ape.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavformat/ape.c b/libavformat/ape.c
index 39a584aa98..d92cb2867d 100644
--- a/libavformat/ape.c
+++ b/libavformat/ape.c
@@ -253,7 +253,7 @@ static int ape_read_header(AVFormatContext * s)
avio_skip(pb, ape->wavheaderlength);
}
- if(!ape->totalframes){
+ if(!ape->totalframes || pb->eof_reached){
av_log(s, AV_LOG_ERROR, "No frames in the file!\n");
return AVERROR(EINVAL);
}
@@ -298,8 +298,11 @@ static int ape_read_header(AVFormatContext * s)
for (i = 0; i < ape->totalframes && !pb->eof_reached; i++)
ape->bittable[i] = avio_r8(pb);
}
- if (pb->eof_reached)
- av_log(s, AV_LOG_WARNING, "File truncated\n");
+ if (pb->eof_reached) {
+ av_log(s, AV_LOG_ERROR, "File truncated\n");
+ ret = AVERROR_INVALIDDATA;
+ goto fail;
+ }
}
ape->frames[0].pos = ape->firstframe;