You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array()
Fixes: 42827/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4900528511909888 Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -933,6 +933,7 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i
|
|||||||
|
|
||||||
static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count)
|
static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count)
|
||||||
{
|
{
|
||||||
|
int64_t ret;
|
||||||
unsigned c = avio_rb32(pb);
|
unsigned c = avio_rb32(pb);
|
||||||
|
|
||||||
//avio_read() used int
|
//avio_read() used int
|
||||||
@@ -947,7 +948,12 @@ static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count)
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
}
|
}
|
||||||
avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
|
avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
|
||||||
avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID));
|
ret = avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID));
|
||||||
|
if (ret != *count * sizeof(UID)) {
|
||||||
|
*count = ret < 0 ? 0 : ret / sizeof(UID);
|
||||||
|
return ret < 0 ? ret : AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user