[vlc-commits] [Git][videolan/vlc][master] 3 commits: svg: cosmetic fix

Tristan Matthews (@tmatth) gitlab at videolan.org
Tue Sep 8 00:30:53 UTC 2026



Tristan Matthews pushed to branch master at VideoLAN / VLC


Commits:
a6bc5307 by Tristan Matthews at 2026-09-08T00:12:54+00:00
svg: cosmetic fix

- - - - -
0e2dcf17 by Tristan Matthews at 2026-09-08T00:12:54+00:00
svg: reject invalid dimensions

Fixes later division by zero (CID #1692714, CID #1692761 and other divisions
not caught by Coverity).

- - - - -
aababdeb by Tristan Matthews at 2026-09-08T00:12:54+00:00
svg: fix height calculation

Dividing out height would break the aspect ratio.

- - - - -


1 changed file:

- modules/codec/svg.c


Changes:

=====================================
modules/codec/svg.c
=====================================
@@ -152,9 +152,9 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
     gboolean has_width, has_height, has_viewbox;
     RsvgLength width, height;
     RsvgRectangle viewbox;
-    
+
     rsvg_handle_get_intrinsic_dimensions( rsvg, &has_width, &width, &has_height, &height, &has_viewbox, &viewbox );
-    
+
     if( has_width && has_height && width.unit == RSVG_UNIT_PX && height.unit == RSVG_UNIT_PX )
     {
         dim.width = (int) width.length;
@@ -173,6 +173,10 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
     #else
     rsvg_handle_get_dimensions( rsvg, &dim );
     #endif
+
+    if( dim.width <= 0 || dim.height <= 0 )
+        goto done;
+
     if( p_sys->f_scale > 0.0 )
     {
         i_width  = (int32_t)(p_sys->f_scale * dim.width);
@@ -189,7 +193,7 @@ static int DecodeBlock( decoder_t *p_dec, block_t *p_block )
         else if( p_sys->i_width > 0 && p_sys->i_height < 0 )
         {
             i_width  = p_sys->i_width;
-            i_height = dim.height * p_sys->i_width / dim.height;
+            i_height = dim.height * p_sys->i_width / dim.width;
         }
         else if( p_sys->i_width > 0 && p_sys->i_height > 0 )
         {



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/18c38d1fb8920d7f09f63a572e30ae651a509f3b...aababdeb4b4d4ffb6f5f405832d40dac64d8ac71

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/18c38d1fb8920d7f09f63a572e30ae651a509f3b...aababdeb4b4d4ffb6f5f405832d40dac64d8ac71
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list