[vlc-commits] Psyche/sharpen: Add chroma checks to prevent crashes
Cheng Sun
git at videolan.org
Mon Jan 2 01:16:28 CET 2012
vlc | branch: master | Cheng Sun <chengsun9 at gmail.com> | Sun Jan 1 23:25:23 2012 +0000| [f15ce26448d6bebd8a9c8cc84257bedd18fb5536] | committer: Jean-Baptiste Kempf
Psyche/sharpen: Add chroma checks to prevent crashes
or malfunctionning filters
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f15ce26448d6bebd8a9c8cc84257bedd18fb5536
---
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 119ea80..95f1feb 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 )
More information about the vlc-commits
mailing list