[vlc-commits] [Git][videolan/vlc][master] demux: libmp4: fix potential overflow in debug string

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Aug 15 09:24:29 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
3b679303 by Steve Lhomme at 2025-08-15T09:09:54+00:00
demux: libmp4: fix potential overflow in debug string

Fixes #29006

- - - - -


1 changed file:

- modules/demux/mp4/libmp4.c


Changes:

=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -37,6 +37,7 @@
 #include <math.h>
 #include <assert.h>
 #include <limits.h>
+#include <stdckdint.h>
 
 /* Some assumptions:
  * The input method HAS to be seekable
@@ -53,14 +54,17 @@ static double conv_fx( int32_t fx ) {
 #ifdef MP4_VERBOSE
 static char * MP4_Time2Str( stime_t i_duration, uint32_t i_scale )
 {
-    uint64_t i_time = (i_scale > 0) ? i_duration / i_scale : 0;
+    uint64_t i_time = (i_scale) ? i_duration / i_scale : 0;
     unsigned h = ( i_time /( 60*60 ) ) % 60;
     unsigned m = ( i_time / 60 ) % 60;
     unsigned s = i_time % 60;
-    unsigned ms = (i_scale) ? (1000*i_duration / i_scale) % 1000 : 0;
+    uint64_t ms;
+    if ( i_scale == 0 || ckd_mul( &ms, 1000, i_duration ) )
+        ms = 0;
+    ms = (ms / i_scale) % 1000;
 
     char *out;
-    if( asprintf( &out, "%u:%.2u:%.2u:%.3u", h, m, s, ms ) < 0 )
+    if( asprintf( &out, "%u:%.2u:%.2u:%.3" PRIu64, h, m, s, ms ) < 0 )
         return NULL;
     return out;
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/3b679303fbb4f77835f4a96d03f4506290ed8def

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