[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: demux: mp4: add sanity check on duration

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Aug 26 06:46:36 UTC 2025



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
5539dab2 by Steve Lhomme at 2025-08-26T05:58:17+00:00
demux: mp4: add sanity check on duration

The duration is coded on 4 or 8 bytes as unsigned. But it is converted to signed
in the MP4_rescale() which creates bogus computation.
A scaled duration should likely never reach INT64_MAX.

Fixes #29256

(cherry picked from commit 5983df5c1fd5f86f895a1cc35e27c3de050d294e)

- - - - -
43786989 by Steve Lhomme at 2025-08-26T05:58:17+00:00
demux: mp4: use the p_mvhd::i_duration once

So it's clearer they are all the same value.

(cherry picked from commit 8753b281ba36378ab2803a5419b9c0713b26a389)

- - - - -


1 changed file:

- modules/demux/mp4/mp4.c


Changes:

=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -876,10 +876,12 @@ static int Open( vlc_object_t * p_this )
     }
 
     p_mvhd = MP4_BoxGet( p_sys->p_moov, "mvhd" );
-    if( p_mvhd && BOXDATA(p_mvhd) && BOXDATA(p_mvhd)->i_timescale )
+    if( p_mvhd && BOXDATA(p_mvhd) && BOXDATA(p_mvhd)->i_timescale &&
+        BOXDATA(p_mvhd)->i_duration < INT64_MAX )
     {
         p_sys->i_timescale = BOXDATA(p_mvhd)->i_timescale;
-        p_sys->i_moov_duration = p_sys->i_duration = BOXDATA(p_mvhd)->i_duration;
+        p_sys->i_moov_duration =
+        p_sys->i_duration =
         p_sys->i_cumulated_duration = BOXDATA(p_mvhd)->i_duration;
     }
     else



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/12c232514def241d81bc4a5358043048d73c52a4...437869892f53c21da183abfaa3ccd4d66c8458d9

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/12c232514def241d81bc4a5358043048d73c52a4...437869892f53c21da183abfaa3ccd4d66c8458d9
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list