[vlc-commits] codec: subsdec: fix div by zero (cid #1346941)

Francois Cartegnie git at videolan.org
Thu Dec 31 18:44:33 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 31 18:18:12 2015 +0100| [f53c706ba3d6d21c147f248fbfbd21fe96a1f98e] | committer: Francois Cartegnie

codec: subsdec: fix div by zero (cid #1346941)

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

 modules/codec/subsdec.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 3d5d7b4..29504d2 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -798,9 +798,13 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
                         }
                         else if ( !strcasecmp( psz_attribute_name, "size" ) )
                         {
-                            p_segment->style->i_font_size = atoi( psz_attribute_value );
-                            p_segment->style->f_font_relsize = STYLE_DEFAULT_REL_FONT_SIZE *
-                                    STYLE_DEFAULT_FONT_SIZE / p_segment->style->i_font_size;
+                            int size = atoi( psz_attribute_value );
+                            if( size )
+                            {
+                                p_segment->style->i_font_size = size;
+                                p_segment->style->f_font_relsize = STYLE_DEFAULT_REL_FONT_SIZE *
+                                        STYLE_DEFAULT_FONT_SIZE / p_segment->style->i_font_size;
+                            }
                         }
                         else if ( !strcasecmp( psz_attribute_name, "color" ) )
                         {



More information about the vlc-commits mailing list