[FFmpeg-devel] [PATCH] libavutil: AVEncodeInfo data structures

Juan De León juandl at google.com
Wed Aug 14 01:22:09 EEST 2019


On Tue, Aug 13, 2019 at 2:49 PM Nicolas George <george at nsup.org> wrote:

> > +    info->blocks_offset = offsetof(AVEncodeInfoFrame, blocks);
>
> You can use sizeof(AVEncodeInfoFrame) and dispense with the blocks final
> array entirely.
>
The array is there so that the structure isn't opaque, it should be
accessed with the function.


> > +    if (!info || idx >= info->nb_blocks || idx < 0)
> > +        return NULL;
>
> How valid is it for applications to call with idx outside the range?

They shouldn't but I figure it's better to return NULL than to get
undefined behaviour.


More information about the ffmpeg-devel mailing list