[vlc-commits] [Git][videolan/vlc][master] 2 commits: demux: mpeg4: replace debug string with assert

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Mar 13 13:45:17 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
f38bb772 by François Cartegnie at 2026-03-13T13:17:25+00:00
demux: mpeg4: replace debug string with assert

Only wrong usage of the function leads to there

- - - - -
5419f175 by François Cartegnie at 2026-03-13T13:17:25+00:00
demux: mpeg4: fix potential leak on error

and returns on first failed read

- - - - -


1 changed file:

- modules/demux/mpeg/mpeg4_iod.c


Changes:

=====================================
modules/demux/mpeg/mpeg4_iod.c
=====================================
@@ -32,6 +32,7 @@
 #include "mpeg4_iod.h"
 
 #include <stdlib.h>
+#include <assert.h>
 
 //#define OD_DEBUG 1
 static void od_debug( vlc_object_t *p_object, const char *format, ... )
@@ -384,7 +385,10 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
                 /* od_descriptor_t *p_iod = (od_descriptor_t *) param; */
                 if ( !ODObjectDescriptorRead( p_object, i_descriptor_data,
                                                p_descriptor_data, childparams ) )
-                {};
+                {
+                    free( p_od );
+                    return i_read_count;
+                };
                 break;
             }
 
@@ -398,7 +402,10 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
                 /* od_descriptor_t *p_iod = (od_descriptor_t *) param; */
                 if ( !OD_InitialObjectDesc_Read( p_object, i_descriptor_data,
                                                   p_descriptor_data, childparams ) )
-                {};
+                {
+                    free( p_iod );
+                    return i_read_count;
+                };
                 break;
             }
 
@@ -409,7 +416,7 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
                 childparams.es_descr = &p_iod->es_descr[i_read_count];
                 if ( !OD_ESDesc_Read( p_object, i_descriptor_data,
                                        p_descriptor_data, childparams ) )
-                {};
+                    return i_read_count;
                 break;
             }
 
@@ -417,7 +424,7 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
             {
                 if ( !OD_DecConfigDesc_Read( p_object, i_descriptor_data,
                                               p_descriptor_data, params ) )
-                {};
+                    return i_read_count;
                 break;
             }
 
@@ -425,7 +432,7 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
             {
                 if ( !OD_DecSpecificDesc_Read( p_object, i_descriptor_data,
                                                 p_descriptor_data, params ) )
-                {};
+                    return i_read_count;
                 break;
             }
 
@@ -433,13 +440,14 @@ static uint8_t OD_Desc_Read( vlc_object_t *p_object, unsigned *pi_data, const ui
             {
                 if ( !OD_SLDesc_Read( p_object, i_descriptor_data,
                                        p_descriptor_data, params ) )
-                {};
+                    return i_read_count;
                 break;
             }
 
             default:
-                od_debug( p_object, "trying to read unsupported descriptor" );
-                break;
+                /* invalid i_target_tag from caller */
+                vlc_assert_unreachable();
+                return 0;
         }
 
         *pp_data += i_length;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1bc17d273913bccc6d6ef008c5a9286d08bbd84d...5419f175b50d08fdb8a613ae95b2b29c9997e53b

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/1bc17d273913bccc6d6ef008c5a9286d08bbd84d...5419f175b50d08fdb8a613ae95b2b29c9997e53b
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