[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: demux: mp4: fix APV invalid deref

François Cartegnie (@fcartegnie) gitlab at videolan.org
Tue Sep 1 04:58:45 UTC 2026



François Cartegnie pushed to branch 3.0.x at VideoLAN / VLC


Commits:
e81366f1 by François Cartegnie at 2026-09-01T06:45:23+02:00
demux: mp4: fix APV invalid deref

refs #29677

(cherry picked from commit 769823f1ddd6e377a81c5dba22037bcac5081276)

- - - - -
5d6318ce by François Cartegnie at 2026-09-01T06:45:23+02:00
demux: mp4: move APV code to proper handler

(cherry picked from commit 4c0f35dd7bf7219df1e98b5640aaaf57b28d072c)

- - - - -


1 changed file:

- modules/demux/mp4/mp4.c


Changes:

=====================================
modules/demux/mp4/mp4.c
=====================================
@@ -697,6 +697,18 @@ static block_t * MP4_Block_Convert( demux_t *p_demux, const mp4_track_t *p_track
     {
         p_block = MP4_RTPHint_Convert( p_demux, p_block, p_track->fmt.i_codec );
     }
+    else if ( p_track->fmt.i_codec == VLC_CODEC_APV )
+    {
+        // the APU are preceeded by 4 bytes containing the size of the data
+        // this is not used by decoder like libavcodec or openapv.
+        if( p_block->i_buffer < 4 )
+        {
+            block_Release( p_block );
+            return NULL;
+        }
+        p_block->p_buffer += 4;
+        p_block->i_buffer -= 4;
+    }
 
     return p_block;
 }
@@ -1411,14 +1423,6 @@ static int DemuxTrack( demux_t *p_demux, mp4_track_t *tk, uint64_t i_readpos,
 
             p_block->i_length = MP4_GetSamplesDuration( p_demux, tk, i_nb_samples );
 
-            if ( tk->fmt.i_codec == VLC_CODEC_APV )
-            {
-                // the APU are preceeded by 4 bytes containing the size of the data
-                // this is not used by decoder like libavcodec or openapv.
-                p_block->p_buffer += 4;
-                p_block->i_buffer -= 4;
-            }
-
             MP4_Block_Send( p_demux, tk, p_block );
         }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/53bfb027c2e16c463e6d943affc9ddc21edd9750...5d6318ce39c2dbd2c055ecb15451c6306814cfde

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/53bfb027c2e16c463e6d943affc9ddc21edd9750...5d6318ce39c2dbd2c055ecb15451c6306814cfde
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list