aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhao Zhili <quinkblack@foxmail.com>2020-07-05 00:51:53 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-07 21:06:18 +0200
commit43035402988335354c51ed1626d8316e05a63866 (patch)
tree93624d526ffa00e8322d0584f517b19672cb66fa
parentd5b9ecc2d1ed345282064e41a2d6fbe4fa03bb4e (diff)
downloadffmpeg-43035402988335354c51ed1626d8316e05a63866.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.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 10b0c1d7e7..c7bffe7aef 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4051,13 +4051,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (a.type == MKTAG('f','r','e','e') &&
a.size >= 8 &&
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');
}