Browse Source

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 806a4d5187)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.2.4
Zhao Zhili Michael Niedermayer 5 years ago
parent
commit
a06587b01a
1 changed files with 5 additions and 6 deletions
  1. +5
    -6
      libavformat/mov.c

+ 5
- 6
libavformat/mov.c View File

@@ -6824,13 +6824,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');
}


Loading…
Cancel
Save