[vlc-devel] [vlc-commits] picture: set a maximum alloc size for sw buffers

Rémi Denis-Courmont remi at remlab.net
Wed Nov 15 15:54:49 CET 2017


Le 15 novembre 2017 15:58:09 GMT+02:00, Thomas Guillem <git at videolan.org> a écrit :
>vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Nov 15
>14:57:31 2017 +0100| [47ae93bdb7b2334afbef16bbf8836cdfadc09159] |
>committer: Thomas Guillem
>
>picture: set a maximum alloc size for sw buffers
>
>>
>http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=47ae93bdb7b2334afbef16bbf8836cdfadc09159
>---
>
> src/misc/picture.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
>diff --git a/src/misc/picture.c b/src/misc/picture.c
>index c14e600d3f..f6671edd51 100644
>--- a/src/misc/picture.c
>+++ b/src/misc/picture.c
>@@ -38,6 +38,8 @@
> #include <vlc_image.h>
> #include <vlc_block.h>
> 
>+#define PICTURE_SW_SIZE_MAX (1<<28) /* 256MB: 8K * 8K * 4*/
>+
> /**
>  * Allocate a new picture in the heap.
>  *
>@@ -62,6 +64,12 @@ static int AllocatePicture( picture_t *p_pic )
>         i_bytes += p->i_pitch * p->i_lines;
>     }
> 
>+    if( i_bytes >= PICTURE_SW_SIZE_MAX )
>+    {
>+        p_pic->i_planes = 0;
>+        return VLC_ENOMEM;
>+    }
>+
>     uint8_t *p_data = aligned_alloc( 16, i_bytes );
>     if( i_bytes > 0 && p_data == NULL )
>     {
>
>_______________________________________________
>vlc-commits mailing list
>vlc-commits at videolan.org
>https://mailman.videolan.org/listinfo/vlc-commits

YUV 4:4:4 HDR is 6 bytes per pixel. RGB(A) may even be 8 bpp.
-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.


More information about the vlc-devel mailing list