avformat/mxfdec: Check llen addition for overflow

Fixes: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
Fixes: 377971441/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4966030696316928

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-12-25 04:54:32 +01:00
parent ae81beb351
commit 53db351654
No known key found for this signature in database
GPG key ID: B18E8928B3948D64

View file

@ -496,6 +496,9 @@ static int klv_read_packet(MXFContext *mxf, KLVPacket *klv, AVIOContext *pb)
if (length < 0)
return length;
klv->length = length;
if (klv->offset > INT64_MAX - 16 - llen)
return AVERROR_INVALIDDATA;
pos = klv->offset + 16 + llen;
if (pos > INT64_MAX - length)
return AVERROR_INVALIDDATA;