Commit d4ced9eb authored by Zhao Zhili's avatar Zhao Zhili Committed by Michael Niedermayer

avformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default

Reviewed-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 806a4d5187aeb82b97898683242886ed1e84f894)
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent b021eba8
...@@ -6977,13 +6977,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -6977,13 +6977,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
a.type == MKTAG('h','o','o','v')) && a.type == MKTAG('h','o','o','v')) &&
a.size >= 8 && a.size >= 8 &&
c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT) { c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT) {
uint8_t buf[8]; uint32_t type;
uint32_t *type = (uint32_t *)buf + 1; avio_skip(pb, 4);
if (avio_read(pb, buf, 8) != 8) type = avio_rl32(pb);
return AVERROR_INVALIDDATA;
avio_seek(pb, -8, SEEK_CUR); avio_seek(pb, -8, SEEK_CUR);
if (*type == MKTAG('m','v','h','d') || if (type == MKTAG('m','v','h','d') ||
*type == MKTAG('c','m','o','v')) { type == MKTAG('c','m','o','v')) {
av_log(c->fc, AV_LOG_ERROR, "Detected moov in a free or hoov atom.\n"); av_log(c->fc, AV_LOG_ERROR, "Detected moov in a free or hoov atom.\n");
a.type = MKTAG('m','o','o','v'); a.type = MKTAG('m','o','o','v');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment