[vlc-commits] [Git][videolan/vlc][3.0.x] demux: libmp4: parse indexes as unsigned

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Thu Mar 26 13:21:16 UTC 2026



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


Commits:
9f6a5858 by François Cartegnie at 2026-03-25T15:58:20+07:00
demux: libmp4: parse indexes as unsigned

refs #29554

(cherry picked from commit f58ef6d4d2e3365aeda72e6d273850936b4210f4)

- - - - -


1 changed file:

- modules/demux/mp4/libmp4.c


Changes:

=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -5164,7 +5164,7 @@ void MP4_BoxDumpStructure( stream_t *s, const MP4_Box_t *p_box )
  **
  *****************************************************************************
  *****************************************************************************/
-static bool get_token( const char **ppsz_path, char **ppsz_token, int *pi_number )
+static bool get_token( const char **ppsz_path, char **ppsz_token, unsigned *pi_number )
 {
     size_t i_len ;
     if( !*ppsz_path[0] )
@@ -5188,15 +5188,11 @@ static bool get_token( const char **ppsz_path, char **ppsz_token, int *pi_number
     if( **ppsz_path == '[' )
     {
         (*ppsz_path)++;
-        *pi_number = strtol( *ppsz_path, NULL, 10 );
-        while( **ppsz_path && **ppsz_path != ']' )
-        {
-            (*ppsz_path)++;
-        }
-        if( **ppsz_path == ']' )
-        {
-            (*ppsz_path)++;
-        }
+        char *endptr = NULL;
+        *pi_number = strtoul( *ppsz_path, &endptr, 10 );
+        if( endptr == *ppsz_path || *endptr != ']' )
+            return false;
+        *ppsz_path = endptr + 1;
     }
     else
     {
@@ -5228,7 +5224,7 @@ static void MP4_BoxGet_Path( const MP4_Box_t **pp_result, const MP4_Box_t *p_box
 //    fprintf( stderr, "path:'%s'\n", psz_path );
     for( ; ; )
     {
-        int i_number;
+        unsigned i_number;
 
         if( !get_token( &psz_path, &psz_token, &i_number ) )
             goto error_box;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9f6a5858764668c4b9d73872989c7dd299b6d59e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/9f6a5858764668c4b9d73872989c7dd299b6d59e
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list