[vlc-commits] logo: check for negative offsets

Erwan Tulou git at videolan.org
Thu Aug 2 02:43:40 CEST 2012


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Aug  2 01:52:09 2012 +0200| [de3ebb997fc44bff4c5494069e2ec53bb7cbfac0] | committer: Erwan Tulou

logo: check for negative offsets

if a logo is bigger than a video and if positioning results in negative
offsets, vlc crashes in the blend function.

This patch adds a warning, and offset is forced to 0 if negative.

Note that a bigger logo is not a problem per se. (Blend truncates the logo).
Only offsetting it with negative values was a problem.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de3ebb997fc44bff4c5494069e2ec53bb7cbfac0
---

 modules/video_filter/logo.c |   10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/modules/video_filter/logo.c b/modules/video_filter/logo.c
index 5e8fa3c..00e5d0e 100644
--- a/modules/video_filter/logo.c
+++ b/modules/video_filter/logo.c
@@ -483,6 +483,16 @@ static picture_t *FilterVideo( filter_t *p_filter, picture_t *p_src )
             }
         }
 
+        if( p_sys->i_pos_x < 0 || p_sys->i_pos_y < 0 )
+        {
+            msg_Warn( p_filter,
+                "logo(%ix%i) doesn't fit into video(%ix%i)",
+                p_fmt->i_visible_width, p_fmt->i_visible_height,
+                i_dst_w,i_dst_h );
+            p_sys->i_pos_x = (p_sys->i_pos_x > 0) ? p_sys->i_pos_x : 0;
+            p_sys->i_pos_y = (p_sys->i_pos_y > 0) ? p_sys->i_pos_y : 0;
+        }
+
         /* */
         const int i_alpha = p_logo->i_alpha != -1 ? p_logo->i_alpha : p_list->i_alpha;
         if( filter_ConfigureBlend( p_sys->p_blend, i_dst_w, i_dst_h, p_fmt ) ||



More information about the vlc-commits mailing list