1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

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

Suggested-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2024-04-02 00:09:32 -03:00
parent 5a06d3810e
commit 8e294abd9d

View File

@ -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;