[vlc-devel] [PATCH] block: double the possible allocation size

Thomas Guillem thomas at gllm.fr
Mon Apr 12 06:59:10 UTC 2021


LGTM

On Thu, Apr 8, 2021, at 15:07, Alexandre Janniaux wrote:
> An 8k RGB image doesn't fit within the maximum allocation size
> constraint installed in block_Alloc. Indeed, 2^27 is 134217728 while
> the RGB 8k jpeg image sample in #19979 will allocate 201326592.
> 
> In general, 8k with 4 byte per pixel can go up to 132710400, without
> taking into account additional padding, so doubling the allocation size
> is enough to handle those pictures, while keeping a limit for the
> maximum allocation size.
> 
> Fixes #19979
> ---
>  src/misc/block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/misc/block.c b/src/misc/block.c
> index 74da567145..a334c33a23 100644
> --- a/src/misc/block.c
> +++ b/src/misc/block.c
> @@ -107,7 +107,7 @@ static void BlockMetaCopy( block_t *restrict out, 
> const block_t *in )
>  
>  block_t *block_Alloc (size_t size)
>  {
> -    if (unlikely(size >> 27))
> +    if (unlikely(size >> 28))
>      {
>          errno = ENOBUFS;
>          return NULL;
> -- 
> 2.31.1
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list