[vlc-commits] block: double the possible allocation size

Alexandre Janniaux git at videolan.org
Mon Apr 12 14:02:25 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Thu Apr  8 15:07:25 2021 +0200| [b0ed24abab66fd07155a5476cb02c50b7baf57d4] | committer: Alexandre Janniaux

block: double the possible allocation size

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b0ed24abab66fd07155a5476cb02c50b7baf57d4
---

 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;



More information about the vlc-commits mailing list