[vlc-commits] [Git][videolan/vlc][master] demux: es: check the CHAP element ID leaves room for the times

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Nov 15 20:44:43 UTC 2026



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
fc06dc18 by Ana Bobillo at 2026-11-15T21:10:13+01:00
demux: es: check the CHAP element ID leaves room for the times

A CHAP frame holds a null-terminated element ID followed by 16 bytes of
start/end times and offsets. The element ID is read with strndup() up to
i_payload - 16 bytes, so an ID of exactly that length followed by its
terminator was accepted with only 15 bytes left after it. Skipping the
ID, its terminator and the 16 bytes then moved p_payload past the end of
the frame and wrapped i_payload around to SIZE_MAX, so the TIT2 check
that follows read past the frame, and a match there would pass a length
of SIZE_MAX - 12 to ID3TextConvert().

Limit the element ID to i_payload - 17 bytes so its terminator and the
16 bytes of times and offsets always fit.

Fixes #30244

- - - - -


1 changed file:

- modules/demux/mpeg/es.c


Changes:

=====================================
modules/demux/mpeg/es.c
=====================================
@@ -1438,7 +1438,9 @@ static int ID3TAG_Parse_Handler( uint32_t i_tag, const uint8_t *p_payload, size_
     }
     else if ( i_tag == VLC_FOURCC('C', 'H', 'A', 'P') && i_payload >= 17 )
     {
-        char *psz_title = strndup( (const char *)p_payload, i_payload - 16 );
+        /* The element ID and its terminator are followed by 16 bytes of
+         * start/end times and offsets */
+        char *psz_title = strndup( (const char *)p_payload, i_payload - 17 );
         size_t i_offset = psz_title ? strlen( psz_title ) : 0;
         if( p_payload[i_offset] != 0 )
         {



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

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