]> git.sesse.net Git - vlc/commitdiff
Fix devision by zero in spu_RenderSubpictures.
authorJean-Paul Saman <jpsaman@videolan.org>
Thu, 29 Nov 2007 15:16:37 +0000 (15:16 +0000)
committerJean-Paul Saman <jpsaman@videolan.org>
Thu, 29 Nov 2007 15:16:37 +0000 (15:16 +0000)
src/video_output/vout_subpictures.c

index c0f9bae6f6fd3b0c1d95479b17aad20047c2c47c..3ba17d4d36a3bf325950849b840fa031b177fbef 100644 (file)
@@ -513,12 +513,20 @@ void spu_RenderSubpictures( spu_t *p_spu, video_format_t *p_fmt,
                             subpicture_t *p_subpic,
                             int i_scale_width_orig, int i_scale_height_orig )
 {
-    int i_source_video_width  = p_fmt->i_width  * 1000 / i_scale_width_orig;
-    int i_source_video_height = p_fmt->i_height * 1000 / i_scale_height_orig;
+    int i_source_video_width;
+    int i_source_video_height;
 
     /* Get lock */
     vlc_mutex_lock( &p_spu->subpicture_lock );
 
+    if( i_scale_width_orig <= 0 )
+        i_scale_width_orig = 1;
+    if( i_scale_height_orig <= 0 )
+        i_scale_height_orig = 1;
+
+    i_source_video_width  = p_fmt->i_width  * 1000 / i_scale_width_orig;
+    i_source_video_height = p_fmt->i_height * 1000 / i_scale_height_orig;
+
     /* Check i_status again to make sure spudec hasn't destroyed the subpic */
     while( ( p_subpic != NULL ) && ( p_subpic->i_status != FREE_SUBPICTURE ) )
     {