summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-09-17 21:30:55 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2022-10-09 22:15:50 +0200
commit955ed9b64195acf6bb715ddbaa30a690b9eb606f (patch)
tree9b1e204aa0d67d53727a901a07b841a286b1ed2e
parent3e208ef0886f3e45931357f2c2a7b26c65f2352b (diff)
downloadffmpeg-955ed9b64195acf6bb715ddbaa30a690b9eb606f.tar.gz
avformat/asfdec_o: Limit packet offset
avoids overflows with it Fixes: signed integer overflow: 9223372036846866010 + 4294967047 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6538296768987136 Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-657169555665715 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 736e9e69d5dbbe1d81885dfef59917eb915d2f96) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/asfdec_o.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c
index edd139ab9e..303ee71cd5 100644
--- a/libavformat/asfdec_o.c
+++ b/libavformat/asfdec_o.c
@@ -1361,6 +1361,8 @@ static int asf_read_packet_header(AVFormatContext *s)
unsigned char error_flags, len_flags, pay_flags;
asf->packet_offset = avio_tell(pb);
+ if (asf->packet_offset > INT64_MAX/2)
+ asf->packet_offset = 0;
error_flags = avio_r8(pb); // read Error Correction Flags
if (error_flags & ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT) {
if (!(error_flags & ASF_ERROR_CORRECTION_LENGTH_TYPE)) {