Anton Khirnov:
> ---
>  libavutil/video_enc_params.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavutil/video_enc_params.c b/libavutil/video_enc_params.c
> index 635176ab91..1779a8799a 100644
> --- a/libavutil/video_enc_params.c
> +++ b/libavutil/video_enc_params.c
> @@ -30,9 +30,9 @@ AVVideoEncParams *av_video_enc_params_alloc(enum 
> AVVideoEncParamsType type,
>                                              unsigned int nb_blocks, size_t 
> *out_size)
>  {
>      AVVideoEncParams *par;
> -    size_t size;
> +    size_t blocks_offset = FFALIGN(sizeof(*par), 8);
> +    size_t size          = blocks_offset;
>  
> -    size = sizeof(*par);
>      if (nb_blocks > (SIZE_MAX - size) / sizeof(AVVideoBlockParams))
>          return NULL;
>      size += sizeof(AVVideoBlockParams) * nb_blocks;
> @@ -44,7 +44,7 @@ AVVideoEncParams *av_video_enc_params_alloc(enum 
> AVVideoEncParamsType type,
>      par->type          = type;
>      par->nb_blocks     = nb_blocks;
>      par->block_size    = sizeof(AVVideoBlockParams);
> -    par->blocks_offset = sizeof(*par);
> +    par->blocks_offset = blocks_offset;
>  
>      if (out_size)
>          *out_size = size;
> 
Wouldn't it be safer to just define a struct { AVVideoEncParams header;
AVVideoBlockParams blocks[1]; } and use the offset of blocks in that?

- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to