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

Alexandre Janniaux ajanni at videolabs.io
Thu Apr 8 13:07:25 UTC 2021


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



More information about the vlc-devel mailing list