[FFmpeg-devel] [PATCH v4] vaapi_encode_mjpeg: fix bad component id bug

Eoff, Ullysses A ullysses.a.eoff at intel.com
Thu Jun 13 18:41:55 EEST 2019


> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of Andreas Rheinhardt
> Sent: Thursday, June 13, 2019 2:11 AM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH v4] vaapi_encode_mjpeg: fix bad component id bug
> 
> Dominik 'Rathann' Mierzejewski:
> > On Friday, 07 June 2019 at 23:45, U. Artie Eoff wrote:
> >> The compound literals assigned to "components"
> >> only exist within the scope of the if/else
> >> block (thanks Mark Thompson for the better
> >> explanation).
> >>
> >> Thus, after this if/else block, "components"
> >> ends up pointing to an arbitrary/undefined
> >> array.  With some compilers and depending on
> >> optimization settings, these arbitrary values
> >> may end up being the same value (i.e. 0 with
> >> GNU GCC 9.x).  Unfortunately, the GNU GCC
> >> compiler, at least, never prints any warnings
> >> about this.
> >>
> >> This patch fixes this issue by assigning the
> >> constant arrays to local variables at function
> >> scope and then pointing "components" to those
> >> as necessary.
> >>
> >> Fixes #7915
> >
> > Brilliant detective work, Artie. Could you open a bug report with gcc
> > upstream? A case like this should get an explicit warning from gcc like
> > you pointed out.
> >
> > Regards,
> > Dominik
> >
> A request for this has already been opened [1].
> It seems that this is also responsible for filesystem corruption on
> linux when using a SSD cache + HDD combination (see [2]).
> 

According to comments in the gcc request, it looks like we
could use " -fsanitize=address".  Anyone care to test it
out to see if it will work?

> - Andreas
> 
> [1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89990
> [2]: https://bugzilla.kernel.org/show_bug.cgi?id=203573
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


More information about the ffmpeg-devel mailing list