[vlc-commits] [Git][videolan/vlc][master] 3 commits: demux: ogg: check bytes to use are not negative

Steve Lhomme (@robUx4) gitlab at videolan.org
Tue Aug 4 05:53:29 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
824f09aa by Steve Lhomme at 2026-08-04T05:33:45+00:00
demux: ogg: check bytes to use are not negative

Like in the rest of the code.

And fix a sign comparison warning.

- - - - -
569992e1 by Steve Lhomme at 2026-08-04T05:33:45+00:00
demux: ogg: don't use too large speex data

- - - - -
2601ab77 by Steve Lhomme at 2026-08-04T05:33:45+00:00
demux: ogg: fix unsigned char warning

C strings are signed.

- - - - -


1 changed file:

- modules/demux/ogg.c


Changes:

=====================================
modules/demux/ogg.c
=====================================
@@ -1401,8 +1401,8 @@ static void Ogg_DecodePacket( demux_t *p_demux,
         }
 
         /* Backup the ogg packet (likely an header packet) */
-        if( !b_xiph && p_oggpacket->bytes &&
-            p_oggpacket->bytes < SIZE_MAX - p_stream->i_headers )
+        if( !b_xiph && p_oggpacket->bytes > 0 &&
+            (size_t)p_oggpacket->bytes < SIZE_MAX - p_stream->i_headers )
         {
             p_stream->p_headers = realloc_or_free( p_stream->p_headers,
                                                    p_stream->i_headers + p_oggpacket->bytes );
@@ -2896,7 +2896,10 @@ static bool Ogg_ReadSpeexHeader( logical_stream_t *p_stream,
     date_Init( &p_stream->dts, p_stream->fmt.audio.i_rate, 1 );
     oggpack_adv( &opb, 32 ); /* mode */
     oggpack_adv( &opb, 32 ); /* mode_bitstream_version */
-    p_stream->fmt.audio.i_channels = oggpack_read( &opb, 32 );
+    uint32_t channels = oggpack_read( &opb, 32 );
+    if (channels > UINT8_MAX)
+        return false;
+    p_stream->fmt.audio.i_channels = channels;
     fill_channels_info(&p_stream->fmt.audio);
     p_stream->fmt.i_bitrate = oggpack_read( &opb, 32 );
     p_stream->special.speex.i_framesize =
@@ -3214,7 +3217,7 @@ static void Ogg_ReadAnnodexHeader( demux_t *p_demux,
         }
 
         char debug_string[32] = {0};
-        strncpy(debug_string, &p_oggpacket->packet[42], __MIN(value_size, 31));
+        strncpy(debug_string, (const char*)&p_oggpacket->packet[42], __MIN(value_size, 31));
         msg_Dbg( p_demux, "AnxData packet info: %"PRId64" / %"PRId64", %d, ``%s''",
                  granule_rate_numerator, granule_rate_denominator,
                  p_stream->i_secondary_header_packets, debug_string );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cf5d214e657fea65e53b4ea8044950a7c5495331...2601ab775855f20bb6ce5a097b7805742ca1139f

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/cf5d214e657fea65e53b4ea8044950a7c5495331...2601ab775855f20bb6ce5a097b7805742ca1139f
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