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

Dominik 'Rathann' Mierzejewski dominik at greysector.net
Thu Jun 13 11:42:06 EEST 2019

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.

Fedora   https://getfedora.org  |  RPM Fusion  http://rpmfusion.org
There should be a science of discontent. People need hard times and
oppression to develop psychic muscles.
        -- from "Collected Sayings of Muad'Dib" by the Princess Irulan

More information about the ffmpeg-devel mailing list