Commit 47ae93bd authored by Thomas Guillem's avatar Thomas Guillem

picture: set a maximum alloc size for sw buffers

parent 766224ce
......@@ -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 )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment