diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2019-06-18 23:17:23 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-01 12:11:55 +0200 |
commit | e6641846b02c51b84f4b83dc6702e36c495fd9d0 (patch) | |
tree | f5c3d8e6ce2f15686455a7d670e595ebcfffea8a | |
parent | 6f4e118f63db4fbd786ad3115e19d00b350da4ba (diff) | |
download | ffmpeg-e6641846b02c51b84f4b83dc6702e36c495fd9d0.tar.gz |
avformat/vqf: Check header_size
Fixes: 15271/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5735262606327808
Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int'
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 7c30ff38880570377168096417f714b21102b343)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/vqf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 969fbefea6..db31955979 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -107,6 +107,9 @@ static int vqf_read_header(AVFormatContext *s) header_size = avio_rb32(s->pb); + if (header_size < 0) + return AVERROR_INVALIDDATA; + st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->codec_id = AV_CODEC_ID_TWINVQ; st->start_time = 0; @@ -120,7 +123,7 @@ static int vqf_read_header(AVFormatContext *s) len = avio_rb32(s->pb); - if ((unsigned) len > INT_MAX/2) { + if ((unsigned) len > INT_MAX/2 || header_size < 8) { av_log(s, AV_LOG_ERROR, "Malformed header\n"); return -1; } |