[vlc-commits] [Git][videolan/vlc][master] 2 commits: codec: cvdsub: check for invalid dimensions

François Cartegnie (@fcartegnie) gitlab at videolan.org
Sat Sep 5 11:16:52 UTC 2026



François Cartegnie pushed to branch master at VideoLAN / VLC


Commits:
4601a2bd by François Cartegnie at 2026-09-05T13:05:23+02:00
codec: cvdsub: check for invalid dimensions

refs #29862

- - - - -
e85b9dc2 by François Cartegnie at 2026-09-05T13:05:23+02:00
codec: cvdsub: check field offsets

refs #29862

- - - - -


1 changed file:

- modules/codec/cvdsub.c


Changes:

=====================================
modules/codec/cvdsub.c
=====================================
@@ -393,8 +393,14 @@ static void ParseMetaInfo( decoder_t *p_dec, block_t *p_spu  )
             int lastx;
             int lasty;
             ExtractXY(lastx, lasty);
-            p_sys->i_width  = lastx - p_sys->i_x_start + 1;
-            p_sys->i_height = lasty - p_sys->i_y_start + 1;
+            if( lastx >= p_sys->i_x_start )
+                p_sys->i_width = lastx - p_sys->i_x_start + 1;
+            else
+                p_sys->i_width = 0;
+            if( lasty >= p_sys->i_y_start )
+                p_sys->i_height = lasty - p_sys->i_y_start + 1;
+            else
+                p_sys->i_height = 0;
 
 #ifdef DEBUG_CVDSUB
             msg_Dbg( p_dec, "end position (%d,%d), w x h: %"PRIu16"x%"PRIu16,
@@ -478,8 +484,11 @@ static void ParseMetaInfo( decoder_t *p_dec, block_t *p_spu  )
         case 0x47:
             /* offset to start of even rows of interlaced image, we correct
              * to make it relative to i_image_offset (usually 4) */
-            p_sys->first_field_offset =
-                (p[2] << 8) + p[3] - p_sys->i_image_offset;
+            p_sys->first_field_offset = (p[2] << 8) + p[3];
+            if( p_sys->first_field_offset < p_sys->i_image_offset )
+                p_sys->first_field_offset -= p_sys->i_image_offset;
+            else
+                p_sys->first_field_offset = 0;
 #ifdef DEBUG_CVDSUB
             msg_Dbg( p_dec, "1st_field_offset %zu",
                      p_sys->first_field_offset );
@@ -489,8 +498,11 @@ static void ParseMetaInfo( decoder_t *p_dec, block_t *p_spu  )
         case 0x4f:
             /* offset to start of odd rows of interlaced image, we correct
              * to make it relative to i_image_offset (usually 4) */
-            p_sys->second_field_offset =
-                (p[2] << 8) + p[3] - p_sys->i_image_offset;
+            p_sys->second_field_offset = (p[2] << 8) + p[3];
+            if( p_sys->second_field_offset < p_sys->i_image_offset )
+                p_sys->second_field_offset -= p_sys->i_image_offset;
+            else
+                p_sys->second_field_offset = 0;
 #ifdef DEBUG_CVDSUB
             msg_Dbg( p_dec, "2nd_field_offset %zu",
                      p_sys->second_field_offset);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f290d0f1419d7b0d60c97c0df7138f72301b3c9f...e85b9dc2a35f727a359e58b85da75b71247d3ce4

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/f290d0f1419d7b0d60c97c0df7138f72301b3c9f...e85b9dc2a35f727a359e58b85da75b71247d3ce4
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