[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: demux: libmp4: stts durations are unsigned

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Fri Mar 27 13:54:00 UTC 2026



Felix Paul Kühne pushed to branch 3.0.x at VideoLAN / VLC


Commits:
785a4b6b by François Cartegnie at 2026-03-27T14:16:18+01:00
demux: libmp4: stts durations are unsigned

(cherry picked from commit 48cba2f05d36fd80ccd8bed29d6f4e96ae79c50c)

- - - - -
ea084298 by François Cartegnie at 2026-03-27T14:16:18+01:00
demux: mp4: patch invalid stts durations

negative or zero durations from cameras

refs #28134

(cherry picked from commit e9d0af87a6967309819caae94594ca6eb3e069e1)

- - - - -


2 changed files:

- modules/demux/mp4/libmp4.c
- modules/demux/mp4/libmp4.h


Changes:

=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -1589,7 +1589,7 @@ static int MP4_ReadBox_stts( stream_t *p_stream, MP4_Box_t *p_box )
     }
 
     p_box->data.p_stts->pi_sample_count = vlc_alloc( count, sizeof(uint32_t) );
-    p_box->data.p_stts->pi_sample_delta = vlc_alloc( count, sizeof(int32_t) );
+    p_box->data.p_stts->pi_sample_delta = vlc_alloc( count, sizeof(uint32_t) );
     p_box->data.p_stts->i_entry_count = count;
 
     if( p_box->data.p_stts->pi_sample_count == NULL
@@ -1602,6 +1602,10 @@ static int MP4_ReadBox_stts( stream_t *p_stream, MP4_Box_t *p_box )
     {
         MP4_GET4BYTES( p_box->data.p_stts->pi_sample_count[i] );
         MP4_GET4BYTES( p_box->data.p_stts->pi_sample_delta[i] );
+        /* Patch bogus durations, including negative stored values */
+        if( p_box->data.p_stts->pi_sample_delta[i] == 0 ||
+            p_box->data.p_stts->pi_sample_delta[i] >= 0xF0000000 )
+            p_box->data.p_stts->pi_sample_delta[i] = 1;
     }
 
 #ifdef MP4_VERBOSE


=====================================
modules/demux/mp4/libmp4.h
=====================================
@@ -621,7 +621,7 @@ typedef struct MP4_Box_data_stts_s
 
     uint32_t i_entry_count;
     uint32_t *pi_sample_count; /* these are array */
-    int32_t  *pi_sample_delta;
+    uint32_t *pi_sample_delta;
 
 } MP4_Box_data_stts_t;
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/d14b9263a72f28f24e6ee9277128bd6dfcacb0e5...ea084298be92b0330e45148e92f7300cd01d4698

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




More information about the vlc-commits mailing list