From b88abd3ac2e824ac216c8d607dd46dc1a5ee4161 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 13 Mar 2022 00:34:52 +0100 Subject: [PATCH] avformat/mxfdec: Check count in mxf_read_strong_ref_array() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Tomas Härdin Signed-off-by: Michael Niedermayer (cherry picked from commit 3015c556f316d4ab364ed55e8bc97cc0f2cc57a3) Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) {