[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: codec: cvdsub: check for invalid dimensions
François Cartegnie (@fcartegnie)
gitlab at videolan.org
Thu Sep 10 11:45:33 UTC 2026
François Cartegnie pushed to branch 3.0.x at VideoLAN / VLC
Commits:
60cf7d67 by François Cartegnie at 2026-09-10T08:43:35+00:00
codec: cvdsub: check for invalid dimensions
refs #29862
(cherry picked from commit 4601a2bde10c47f3332ee74c600495c7897ab125)
- - - - -
2c90d8a9 by François Cartegnie at 2026-09-10T08:43:35+00:00
codec: cvdsub: check field offsets
refs #29862
(cherry picked from commit e85b9dc2a35f727a359e58b85da75b71247d3ce4)
- - - - -
1 changed file:
- modules/codec/cvdsub.c
Changes:
=====================================
modules/codec/cvdsub.c
=====================================
@@ -396,8 +396,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: %dx%d",
@@ -479,8 +485,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 );
@@ -490,8 +499,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/66455a98c8c515796b4a192acaa125c5d68c76c8...2c90d8a9ff563ae8f1bbb111953599863f278b82
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/66455a98c8c515796b4a192acaa125c5d68c76c8...2c90d8a9ff563ae8f1bbb111953599863f278b82
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