[vlc-commits] [Git][videolan/vlc][master] mpeg4video: add early check on zero i_fps_num

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Aug 1 06:37:47 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
28a958d3 by Steve Lhomme at 2026-08-01T05:55:34+00:00
mpeg4video: add early check on zero i_fps_num

When i_fps_num is read it can never be 0.
If it's 0 it has not be read. And we can't use i_fps_num - 1 to
find the number of increment bits to read.

Fixes #29756

- - - - -


1 changed file:

- modules/packetizer/mpeg4video.c


Changes:

=====================================
modules/packetizer/mpeg4video.c
=====================================
@@ -506,6 +506,9 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
     int i_modulo_time_base = 0, i_time_increment_bits;
     bs_t s;
 
+    if( p_sys->i_fps_num == 0 )
+        return VLC_EGENERIC;
+
     bs_init( &s, &p_vop->p_buffer[4], p_vop->i_buffer - 4 );
 
     switch( bs_read( &s, 2 ) )
@@ -548,7 +551,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
     }
 
     int64_t i_time_diff = (i_time_ref + i_time_increment) - (p_sys->i_last_time + p_sys->i_last_timeincr);
-    if( p_sys->i_fps_num && i_modulo_time_base == 0 && i_time_diff < 0 && -i_time_diff > p_sys->i_fps_num )
+    if( i_modulo_time_base == 0 && i_time_diff < 0 && -i_time_diff > p_sys->i_fps_num )
     {
         msg_Warn(p_dec, "missing modulo_time_base update");
         i_modulo_time_base += -i_time_diff / p_sys->i_fps_num;
@@ -565,7 +568,7 @@ static int ParseVOP( decoder_t *p_dec, block_t *p_vop )
         p_dec->fmt_in->video.i_frame_rate_base,
         p_dec->fmt_in->video.i_frame_rate);
     }
-    else if( p_sys->i_fps_num )
+    else
     {
         i_time_diff = (i_time_ref + i_time_increment) - (p_sys->i_last_time + p_sys->i_last_timeincr);
         p_sys->i_interpolated_pts += vlc_tick_from_samples( i_time_diff, p_sys->i_fps_num );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/28a958d3b4180941c85a70509e73807c4fd7094c

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/28a958d3b4180941c85a70509e73807c4fd7094c
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