diff options
author | Zhao Zhili <quinkblack@foxmail.com> | 2020-07-05 00:51:53 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2021-09-11 21:23:48 +0200 |
commit | a79700555fb2de8f18dbb0bd0c72a77aa59613f1 (patch) | |
tree | 1d7088996c0670f5a27279d5cbb7c7a43e65d67b | |
parent | 2a34d7476d78a5b970ed332f4e6c910c383128e1 (diff) | |
download | ffmpeg-a79700555fb2de8f18dbb0bd0c72a77aa59613f1.tar.gz |
avformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 806a4d5187aeb82b97898683242886ed1e84f894)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavformat/mov.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 407d801775..1668b599c8 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5706,13 +5706,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) a.size >= 8 && c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT && c->moov_retry) { - uint8_t buf[8]; - uint32_t *type = (uint32_t *)buf + 1; - if (avio_read(pb, buf, 8) != 8) - return AVERROR_INVALIDDATA; + uint32_t type; + avio_skip(pb, 4); + type = avio_rl32(pb); avio_seek(pb, -8, SEEK_CUR); - if (*type == MKTAG('m','v','h','d') || - *type == MKTAG('c','m','o','v')) { + if (type == MKTAG('m','v','h','d') || + type == MKTAG('c','m','o','v')) { av_log(c->fc, AV_LOG_ERROR, "Detected moov in a free atom.\n"); a.type = MKTAG('m','o','o','v'); } |