]> git.sesse.net Git - vlc/commitdiff
strncmp => memcmp (refs #258)
authorRémi Denis-Courmont <rem@videolan.org>
Sun, 10 Jul 2005 08:13:48 +0000 (08:13 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Sun, 10 Jul 2005 08:13:48 +0000 (08:13 +0000)
ogg.c : FIXME FIXME FIXME
I don't know Ogg format well, but don't we have a possible out-of-bound
read at line 1346 and following ??

modules/demux/dts.c
modules/demux/ogg.c

index 6473c8d2f11321d8456ced26aeee0c445fb961d3..0fa078f777becb1b42a30a690d2d9f23e7fdb27e 100644 (file)
@@ -78,13 +78,13 @@ static int Open( vlc_object_t * p_this )
 
     /* Check if we are dealing with a WAV file */
     if( stream_Peek( p_demux->s, &p_peek, 20 ) == 20 &&
-        !strncmp( p_peek, "RIFF", 4 ) && !strncmp( &p_peek[8], "WAVE", 4 ) )
+        !memcmp( p_peek, "RIFF", 4 ) && !memcmp( &p_peek[8], "WAVE", 4 ) )
     {
         int i_size;
 
         /* Find the wave format header */
         i_peek = 20;
-        while( strncmp( p_peek + i_peek - 8, "fmt ", 4 ) )
+        while( memcmp( p_peek + i_peek - 8, "fmt ", 4 ) )
         {
             i_size = GetDWLE( p_peek + i_peek - 4 );
             if( i_size + i_peek > DTS_PROBE_SIZE ) return VLC_EGENERIC;
@@ -110,7 +110,7 @@ static int Open( vlc_object_t * p_this )
             return VLC_EGENERIC;
 
         /* Skip the wave header */
-        while( strncmp( p_peek + i_peek - 8, "data", 4 ) )
+        while( memcmp( p_peek + i_peek - 8, "data", 4 ) )
         {
             i_size = GetDWLE( p_peek + i_peek - 4 );
             if( i_size + i_peek > DTS_PROBE_SIZE ) return VLC_EGENERIC;
index 364fc84544b93c42cf6e7398b1d681ab8ef76216..e808ea6d41f35810f851ba4c71d71919a08971b0 100644 (file)
@@ -183,7 +183,7 @@ static int Open( vlc_object_t * p_this )
 
     /* Check if we are dealing with an ogg stream */
     if( stream_Peek( p_demux->s, &p_peek, 4 ) < 4 ) return VLC_EGENERIC;
-    if( strcmp( p_demux->psz_demux, "ogg" ) && strncmp( p_peek, "OggS", 4 ) )
+    if( strcmp( p_demux->psz_demux, "ogg" ) && memcmp( p_peek, "OggS", 4 ) )
     {
         return VLC_EGENERIC;
     }
@@ -276,14 +276,14 @@ static int Demux( demux_t * p_demux )
             {
                 if( p_stream->fmt.i_codec == VLC_FOURCC('t','h','e','o') &&
                         oggpacket.bytes >= 7 &&
-                        ! strncmp( &oggpacket.packet[1], "theora", 6 ) )
+                        ! memcmp( &oggpacket.packet[1], "theora", 6 ) )
                 {
                     Ogg_ReadTheoraHeader( p_stream, &oggpacket );
                     p_stream->secondary_header_packets = 0;
                 }
                 else if( p_stream->fmt.i_codec == VLC_FOURCC('v','o','r','b') &&
                         oggpacket.bytes >= 7 &&
-                        ! strncmp( &oggpacket.packet[1], "vorbis", 6 ) )
+                        ! memcmp( &oggpacket.packet[1], "vorbis", 6 ) )
                 {
                     Ogg_ReadVorbisHeader( p_stream, &oggpacket );
                     p_stream->secondary_header_packets = 0;
@@ -404,7 +404,7 @@ static int Ogg_ReadPage( demux_t *p_demux, ogg_page *p_oggpage )
 {
     demux_sys_t *p_ogg = p_demux->p_sys  ;
     int i_read = 0;
-    byte_t *p_buffer;
+    char *p_buffer;
 
     while( ogg_sync_pageout( &p_ogg->oy, p_oggpage ) != 1 )
     {
@@ -484,13 +484,13 @@ static void Ogg_DecodePacket( demux_t *p_demux,
     }
 
     if( p_oggpacket->bytes >= 7 &&
-        ! strncmp ( &p_oggpacket->packet[0], "Annodex", 7 ) )
+        ! memcmp ( &p_oggpacket->packet[0], "Annodex", 7 ) )
     {
         /* it's an Annodex packet -- skip it (do nothing) */
         return; 
     }
     else if( p_oggpacket->bytes >= 7 &&
-        ! strncmp ( &p_oggpacket->packet[0], "AnxData", 7 ) )
+        ! memcmp ( &p_oggpacket->packet[0], "AnxData", 7 ) )
     {
         /* it's an AnxData packet -- skip it (do nothing) */
         return; 
@@ -756,14 +756,14 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
 
                 /* Check for Vorbis header */
                 if( oggpacket.bytes >= 7 &&
-                    ! strncmp( &oggpacket.packet[1], "vorbis", 6 ) )
+                    ! memcmp( &oggpacket.packet[1], "vorbis", 6 ) )
                 {
                     Ogg_ReadVorbisHeader( p_stream, &oggpacket );
                     msg_Dbg( p_demux, "found vorbis header" );
                 }
                 /* Check for Speex header */
                 else if( oggpacket.bytes >= 7 &&
-                    ! strncmp( &oggpacket.packet[0], "Speex", 5 ) )
+                    ! memcmp( &oggpacket.packet[0], "Speex", 5 ) )
                 {
                     Ogg_ReadSpeexHeader( p_stream, &oggpacket );
                     msg_Dbg( p_demux, "found speex header, channels: %i, "
@@ -773,7 +773,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 }
                 /* Check for Flac header (< version 1.1.1) */
                 else if( oggpacket.bytes >= 4 &&
-                    ! strncmp( &oggpacket.packet[0], "fLaC", 4 ) )
+                    ! memcmp( &oggpacket.packet[0], "fLaC", 4 ) )
                 {
                     msg_Dbg( p_demux, "found FLAC header" );
 
@@ -787,8 +787,8 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 }
                 /* Check for Flac header (>= version 1.1.1) */
                 else if( oggpacket.bytes >= 13 && oggpacket.packet[0] ==0x7F &&
-                    ! strncmp( &oggpacket.packet[1], "FLAC", 4 ) &&
-                    ! strncmp( &oggpacket.packet[9], "fLaC", 4 ) )
+                    ! memcmp( &oggpacket.packet[1], "FLAC", 4 ) &&
+                    ! memcmp( &oggpacket.packet[9], "fLaC", 4 ) )
                 {
                     int i_packets = ((int)oggpacket.packet[7]) << 8 |
                         oggpacket.packet[8];
@@ -806,7 +806,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 }
                 /* Check for Theora header */
                 else if( oggpacket.bytes >= 7 &&
-                         ! strncmp( &oggpacket.packet[1], "theora", 6 ) )
+                         ! memcmp( &oggpacket.packet[1], "theora", 6 ) )
                 {
                     Ogg_ReadTheoraHeader( p_stream, &oggpacket );
 
@@ -816,7 +816,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 }
                 /* Check for Tarkin header */
                 else if( oggpacket.bytes >= 7 &&
-                         ! strncmp( &oggpacket.packet[1], "tarkin", 6 ) )
+                         ! memcmp( &oggpacket.packet[1], "tarkin", 6 ) )
                 {
                     oggpack_buffer opb;
 
@@ -836,7 +836,7 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 }
                 /* Check for Annodex header */
                 else if( oggpacket.bytes >= 7 &&
-                         ! strncmp( &oggpacket.packet[0], "Annodex", 7 ) )
+                         ! memcmp( &oggpacket.packet[0], "Annodex", 7 ) )
                 {
                     Ogg_ReadAnnodexHeader( VLC_OBJECT(p_demux), p_stream,
                                            &oggpacket );
@@ -846,13 +846,13 @@ static int Ogg_FindLogicalStreams( demux_t *p_demux )
                 }
                 /* Check for Annodex header */
                 else if( oggpacket.bytes >= 7 &&
-                         ! strncmp( &oggpacket.packet[0], "AnxData", 7 ) )
+                         ! memcmp( &oggpacket.packet[0], "AnxData", 7 ) )
                 {
                     Ogg_ReadAnnodexHeader( VLC_OBJECT(p_demux), p_stream,
                                            &oggpacket );
                 }
                 else if( oggpacket.bytes >= 142 &&
-                         !strncmp( &oggpacket.packet[1],
+                         !memcmp( &oggpacket.packet[1],
                                    "Direct Show Samples embedded in Ogg", 35 ))
                 {
                     /* Old header type */
@@ -1310,7 +1310,7 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
                                    logical_stream_t *p_stream,
                                    ogg_packet *p_oggpacket )
 {
-    if( ! strncmp( &p_oggpacket->packet[0], "Annodex", 7 ) )
+    if( ! memcmp( &p_oggpacket->packet[0], "Annodex", 7 ) )
     {
         oggpack_buffer opb;
 
@@ -1328,7 +1328,7 @@ static void Ogg_ReadAnnodexHeader( vlc_object_t *p_this,
         timebase_numerator = GetQWLE( &p_oggpacket->packet[16] );
         timebase_denominator = GetQWLE( &p_oggpacket->packet[24] );
     }
-    else if( ! strncmp( &p_oggpacket->packet[0], "AnxData", 7 ) )
+    else if( ! memcmp( &p_oggpacket->packet[0], "AnxData", 7 ) )
     {
         uint64_t granule_rate_numerator;
         uint64_t granule_rate_denominator;