[FFmpeg-devel] [PATCH v2] avformat/mov: Fix unaligned read of uint32_t and endian-dependance in mov_read_default
Michael Niedermayer
michael at niedermayer.cc
Tue Jul 7 20:26:51 EEST 2020
On Tue, Jul 07, 2020 at 06:39:52PM +0200, Andreas Rheinhardt wrote:
> Zhao Zhili:
> > ---
> > libavformat/mov.c | 11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/libavformat/mov.c b/libavformat/mov.c
> > index df5bebdff1..da438e4e2c 100644
> > --- a/libavformat/mov.c
> > +++ b/libavformat/mov.c
> > @@ -6945,13 +6945,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');
> > }
> >
> Just looking at the diff, it's LGTM. But I am not the maintainer of mov
> and I also haven't tested it.
doesnt seem to break anything
will apply
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200707/691c10a9/attachment.sig>
More information about the ffmpeg-devel
mailing list