[vlc-devel] commit: rotate filter: Avoid a crash (Derk-Jan Hartman )

git version control git at videolan.org
Mon Jun 22 21:08:08 CEST 2009


vlc | branch: 1.0-bugfix | Derk-Jan Hartman <hartman at videolan.org> | Mon Jun 22 20:52:53 2009 +0200| [771539a5a065adec9aa2a5d8086b855fd99ac28e] | committer: Derk-Jan Hartman 

rotate filter: Avoid a crash

This fixes a DIVIDEBYZERO crash in the rotate filter. Does not seem like the right solution to me, but dionoea should probably look into that, since he wrote most of this filter.

This crash occured with http://streams.videolan.org/issues/HIGNFY%20S25E02%20-%20Part%201.flv

plane 1 (non Y-plane)
i_visible_lines = 119
p_pic->p[Y_PLANE].i_visible_pitch = 320
p_pic->p[Y_PLANE].i_visible_lines = 239
i_visible_pitch = 160
(cherry picked from commit fde2277f8f994c60b60372db98061ab1b72af3f3)

Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>

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

 modules/video_filter/rotate.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/video_filter/rotate.c b/modules/video_filter/rotate.c
index d41ea99..c0f1965 100644
--- a/modules/video_filter/rotate.c
+++ b/modules/video_filter/rotate.c
@@ -195,7 +195,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         const int i_pitch         = p_pic->p[i_plane].i_pitch;
         const int i_hidden_pitch  = i_pitch - i_visible_pitch;
 
-        const int i_aspect = ( i_visible_lines * p_pic->p[Y_PLANE].i_visible_pitch ) / ( p_pic->p[Y_PLANE].i_visible_lines * i_visible_pitch );
+        const int i_aspect = __MAX( 1, ( i_visible_lines * p_pic->p[Y_PLANE].i_visible_pitch ) / ( p_pic->p[Y_PLANE].i_visible_lines * i_visible_pitch ));
         /* = 2 for U and V planes in YUV 4:2:2, = 1 otherwise */
 
         const int i_line_center = i_visible_lines>>1;




More information about the vlc-devel mailing list