[FFmpeg-cvslog] avformat/mov: simplify the entry count overflow check in the keys atom

James Almer git at videolan.org
Tue Apr 2 15:13:35 EEST 2024


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Apr  2 00:09:32 2024 -0300| [8e294abd9d21ed034371ace87649300405dd5a4b] | committer: James Almer

avformat/mov: simplify the entry count overflow check in the keys atom

Suggested-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index a935ef7326..b96a02b0d9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5025,7 +5025,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     avio_skip(pb, 4);
     count = avio_rb32(pb);
     atom.size -= 8;
-    if (count > UINT_MAX / sizeof(*c->meta_keys) - 1) {
+    if (count >= UINT_MAX / sizeof(*c->meta_keys)) {
         av_log(c->fc, AV_LOG_ERROR,
                "The 'keys' atom with the invalid key count: %"PRIu32"\n", count);
         return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list