diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2021-07-11 12:39:34 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-12 11:22:04 +0200 |
commit | 00ecb2216730635498532d8b4c316898e00936e5 (patch) | |
tree | 459941adb9ae8da8673111f752f5eb8ebbddef42 /libavformat | |
parent | e61b25e2557394e640a5aae901473785a4b23db5 (diff) | |
download | ffmpeg-00ecb2216730635498532d8b4c316898e00936e5.tar.gz |
avformat/mxfdec: Check size for shrinking
av_shrink_packet() takes int size, so size must fit in int
Fixes: out of array access
Fixes: 35607/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4875541323841536
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 65b862ab59c4bfaae98be596b84a072f52444398)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mxfdec.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index c8442aadf2..a5cdacb881 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -465,7 +465,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv return AVERROR_INVALIDDATA; // enc. code size = klv_decode_ber_length(pb); - if (size < 32 || size - 32 < orig_size) + if (size < 32 || size - 32 < orig_size || (int)orig_size != orig_size) return AVERROR_INVALIDDATA; avio_read(pb, ivec, 16); avio_read(pb, tmpbuf, 16); |