1
mirror of https://code.videolan.org/videolan/vlc synced 2024-10-03 01:31:53 +02:00

Psyche/sharpen: Add chroma checks to prevent crashes

or malfunctionning filters

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
This commit is contained in:
Cheng Sun 2012-01-01 23:25:23 +00:00 committed by Jean-Baptiste Kempf
parent ef88dfda4c
commit f15ce26448
2 changed files with 14 additions and 0 deletions

View File

@ -84,6 +84,13 @@ static int Create( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
const vlc_chroma_description_t *p_chroma = vlc_fourcc_GetChromaDescription( fourcc );
if( !p_chroma || p_chroma->plane_count != 3 || p_chroma->pixel_size != 1 ) {
msg_Err( p_filter, "Unsupported chroma (%4.4s)", (char*)&fourcc );
return VLC_EGENERIC;
}
/* Allocate structure */
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_filter->p_sys == NULL )

View File

@ -117,6 +117,13 @@ static int Create( vlc_object_t *p_this )
{
filter_t *p_filter = (filter_t *)p_this;
const vlc_fourcc_t fourcc = p_filter->fmt_in.video.i_chroma;
const vlc_chroma_description_t *p_chroma = vlc_fourcc_GetChromaDescription( fourcc );
if( !p_chroma || p_chroma->plane_count != 3 || p_chroma->pixel_size != 1 ) {
msg_Err( p_filter, "Unsupported chroma (%4.4s)", (char*)&fourcc );
return VLC_EGENERIC;
}
/* Allocate structure */
p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
if( p_filter->p_sys == NULL )