[FFmpeg-devel] [PATCH] lavu/video_enc_params: make sure blocks are properly aligned
Anton Khirnov
anton at khirnov.net
Thu Apr 8 12:17:34 EEST 2021
---
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;
--
2.30.2
More information about the ffmpeg-devel
mailing list