ffmpeg | branch: master | Michael Niedermayer <[email protected]> | Sun 
Mar 13 00:34:52 2022 +0100| [3015c556f316d4ab364ed55e8bc97cc0f2cc57a3] | 
committer: Michael Niedermayer

avformat/mxfdec: Check count in mxf_read_strong_ref_array()

Reviewed-by: Tomas Härdin <[email protected]>
Signed-off-by: Michael Niedermayer <[email protected]>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3015c556f316d4ab364ed55e8bc97cc0f2cc57a3
---

 libavformat/mxfdec.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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) {

_______________________________________________
ffmpeg-cvslog mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to