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:27:35 +0200
commit2a549b2e7d9f3edd4744afe288fcb012daee4a1e (patch)
tree746d07be45860775e75b50576232326fa8d39a11
parent79ad18ddbd2f7feee33e24bff02afe4c10928b75 (diff)
downloadffmpeg-2a549b2e7d9f3edd4744afe288fcb012daee4a1e.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 84ab0cefd7..ba7466f960 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -875,7 +875,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) {