vlc/vlc-1.2 | branch: master | Cheng Sun <[email protected]> | Sun Jan 1 23:25:23 2012 +0000| [775cc9aa9af711768ef1bb79751faf898aac28f7] | committer: Jean-Baptiste Kempf
Psyche/sharpen: Add chroma checks to prevent crashes or malfunctionning filters Signed-off-by: Jean-Baptiste Kempf <[email protected]> (cherry picked from commit f15ce26448d6bebd8a9c8cc84257bedd18fb5536) Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=775cc9aa9af711768ef1bb79751faf898aac28f7 --- modules/video_filter/psychedelic.c | 7 +++++++ modules/video_filter/sharpen.c | 7 +++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/modules/video_filter/psychedelic.c b/modules/video_filter/psychedelic.c index 9ec3757..6a8510c 100644 --- a/modules/video_filter/psychedelic.c +++ b/modules/video_filter/psychedelic.c @@ -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 ) diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c index f876c9b..81fb3f9 100644 --- a/modules/video_filter/sharpen.c +++ b/modules/video_filter/sharpen.c @@ -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 ) _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
