]> git.sesse.net Git - vlc/commitdiff
logo: check for negative offsets
authorErwan Tulou <erwan10@videolan.org>
Wed, 1 Aug 2012 23:52:09 +0000 (01:52 +0200)
committerErwan Tulou <erwan10@videolan.org>
Thu, 2 Aug 2012 00:34:25 +0000 (02:34 +0200)
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.

modules/video_filter/logo.c

index 5e8fa3cf437cfc64f40b045bb67788c0a542ea94..00e5d0e1fb881b1c026c793f8306535614111daf 100644 (file)
@@ -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 ) ||