From 3015c556f316d4ab364ed55e8bc97cc0f2cc57a3 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 13 Mar 2022 00:34:52 +0100 Subject: 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 --- libavformat/mxfdec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libavformat/mxfdec.c') diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index a32c1c55a4..a858bbb7be 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -933,7 +933,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) { -- cgit v1.2.3