[FFmpeg-devel] [PATCH] mov: Skip computing SAR from invalid display matrix elements

Anton Khirnov anton at khirnov.net
Wed Mar 31 21:54:04 EEST 2021


Quoting Vittorio Giovara (2021-03-31 18:43:02)
> On Wed, Mar 31, 2021 at 2:41 PM Anton Khirnov <anton at khirnov.net> wrote:
> 
> > Quoting Vittorio Giovara (2021-03-30 18:55:27)
> > > Hello,
> > > I was debugging an issue with a video file containing an invalid
> > > display matrix, probably produced by a non conforming software.
> > >
> > > The content of the matrix is:
> > > 00000000:            0       65536           0
> > > 00000001:           -1           0           0
> > > 00000002:            0           0  1073741824
> > >
> > > The -1 (stored as 4294967295) was probably a 1 shifted 32 times instead
> > > of 16. The problem is that this value is bypassing the validation check
> > > in the code below, and the resulting computed SAR value becomes 1:65536.
> > >
> > > This change interprets extremely low entries as invalid and makes sure
> > > to skip them in the SAR computation. This passes fate, but I haven't been
> > > able to test this extensively.
> > > Please see the attached patch, any feedback or better solution is
> > welcome.
> > > --
> > > Vittorio
> > >
> > > From 54ec72276cbb6f2536e73ff81b7d49a736ec1900 Mon Sep 17 00:00:00 2001
> > > From: Vittorio Giovara <vittorio.giovara at gmail.com>
> > > Date: Tue, 30 Mar 2021 16:47:39 +0200
> > > Subject: [PATCH] mov: Skip computing SAR from invalid display matrix
> > elements
> > >
> > > ---
> >
> > I'm wondering if that code should set sample_aspect_ratio at all. There
> > are two other bits of code in mov.c that may set sample_aspect_ratio,
> > and it's not clear whether it applies _in addition_ to the display
> > matrix or not.
> >
> 
> Unfortunately there are many (old-ish) samples that rely on the display
> matrix to adjust the aspect ratio.
> We added a test for this case in particular, check out fate-mov-zombie if
> you have some time.

But then what do you do if a file has both the display matrix and the
pasp atom?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list