[FFmpeg-cvslog] avformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default
Zhao Zhili
git at videolan.org
Thu Jul 9 23:19:51 EEST 2020
ffmpeg | branch: release/4.3 | Zhao Zhili <quinkblack at foxmail.com> | Sun Jul 5 00:51:53 2020 +0800| [d4ced9ebb7925f7e0ed43535d0b7a40de72098b9] | committer: Michael Niedermayer
avformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 806a4d5187aeb82b97898683242886ed1e84f894)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d4ced9ebb7925f7e0ed43535d0b7a40de72098b9
---
libavformat/mov.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 66db318ec3..dfb41b93bf 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6977,13 +6977,12 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
a.type == MKTAG('h','o','o','v')) &&
a.size >= 8 &&
c->fc->strict_std_compliance < FF_COMPLIANCE_STRICT) {
- 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 or hoov atom.\n");
a.type = MKTAG('m','o','o','v');
}
More information about the ffmpeg-cvslog
mailing list