aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-03-13 00:34:52 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-04-06 20:38:06 +0200
commitb88abd3ac2e824ac216c8d607dd46dc1a5ee4161 (patch)
treed08f141d59b1192a486010a3941cf90957bd6827
parent023b7e79792020af978c1743d565ae4326395dc6 (diff)
downloadffmpeg-b88abd3ac2e824ac216c8d607dd46dc1a5ee4161.tar.gz
avformat/mxfdec: Check count in mxf_read_strong_ref_array()
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 3015c556f316d4ab364ed55e8bc97cc0f2cc57a3) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mxfdec.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 442d652cf6..9e52e60595 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -852,7 +852,13 @@ 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)
{
- *count = avio_rb32(pb);
+ unsigned c = avio_rb32(pb);
+
+ //avio_read() used int
+ if (c > INT_MAX / sizeof(UID))
+ return AVERROR_PATCHWELCOME;
+ *count = c;
+
av_free(*refs);
*refs = av_calloc(*count, sizeof(UID));
if (!*refs) {