[vlc-commits] [Git][videolan/vlc][master] 16 commits: demux: asf: use uint32_t for the skip variable

Steve Lhomme (@robUx4) gitlab at videolan.org
Wed Nov 2 09:33:05 UTC 2022



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
daf3e8ab by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: asf: use uint32_t for the skip variable

It's filled with uint32_t values or constants.

- - - - -
01dadb2d by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: au: use uint32_t for the skip variable

It's filled with a uint32_t value that is checked not to underflow from the
substraction.

- - - - -
9727d330 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: avi: use uint32_t for the skip variable

It's filled with uint32_t values that cannot be higher than UINT32_MAX or
constants.

- - - - -
b1fdebb7 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: mp4: use size_t for the mp4_box_headersize() recipient

- - - - -
73d4caf4 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: mp4: use uint64_t for the amount to read/skip

It should have the same range as i_pos.

- - - - -
7efa88a1 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: ps: make i_skip unsigned

It can never be negative as it's only growing from 0. And we don't want to skip
backward.

- - - - -
29dc4652 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: ps: make i_peek a ssize_t as it receives values from vlc_stream_Peek()

- - - - -
eae7047d by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: ps: make OpenCommon i_skip unsigned

It's filled with uint16_t values or constants.

- - - - -
44363809 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: m3u: make the skip offset unsigned

It's either 0 or 3.

- - - - -
11238bed by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: asf: return an error when skipping bytes fail

The end of file is probably reached. This is the same kind of error checked in
the vlc_stream_Peek() call below.

- - - - -
e889e732 by Steve Lhomme at 2022-11-02T06:37:41+00:00
modules: replace skip size comparisons by skip size equality check

Compiler may generate better code and we really want to skip exactly that
amount. This will also bring some consistency with the other
vlc_stream_Read(NULL) callers.

- - - - -
eda04abf by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: wav: only check the vlc_stream_Read(NULL) result against the size skipped

- - - - -
564ef290 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: asfpacket: only check the vlc_stream_Read(NULL) result against the size skipped

- - - - -
2172376d by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: avi: return early on invalid size to skip

- - - - -
01100e13 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: nuv: bring the vlc_stream_Read(NULL) check on one line

No functional changes. Just makes it easier to refactor the code if needed.

- - - - -
daa1e367 by Steve Lhomme at 2022-11-02T06:37:41+00:00
demux: ps: invert the vlc_stream_Read(NULL) check

No functional changes. Just bring some consistency between the call to make it
easier to refactor the code if needed.

- - - - -


20 changed files:

- modules/demux/aiff.c
- modules/demux/asf/asfpacket.c
- modules/demux/au.c
- modules/demux/avi/avi.c
- modules/demux/avi/libavi.c
- modules/demux/caf.c
- modules/demux/dmxmus.c
- modules/demux/flac.c
- modules/demux/mjpeg.c
- modules/demux/mp4/libmp4.c
- modules/demux/mpeg/ps.c
- modules/demux/nsv.c
- modules/demux/nuv.c
- modules/demux/playlist/m3u.c
- modules/demux/pva.c
- modules/demux/rawvid.c
- modules/demux/smf.c
- modules/demux/ty.c
- modules/demux/voc.c
- modules/demux/wav.c


Changes:

=====================================
modules/demux/aiff.c
=====================================
@@ -118,7 +118,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* skip aiff header */
-    if( vlc_stream_Read( p_demux->s, NULL, 12 ) < 12 )
+    if( vlc_stream_Read( p_demux->s, NULL, 12 ) != 12 )
         return VLC_EGENERIC;
 
     /* Fill p_demux field */


=====================================
modules/demux/asf/asfpacket.c
=====================================
@@ -70,12 +70,6 @@ static inline int GetValue2b(uint32_t *var, const uint8_t *p, unsigned int *skip
     }
 }
 
-static uint32_t SkipBytes( stream_t *s, uint32_t i_bytes )
-{
-    ssize_t i_read = vlc_stream_Read( s, NULL, i_bytes );
-    return i_read > 0 ? (uint32_t) i_read : 0;
-}
-
 static int DemuxSubPayload( asf_packet_sys_t *p_packetsys,
                             uint8_t i_stream_number, asf_track_info_t *p_tkinfo,
                             uint32_t i_sub_payload_data_length, vlc_tick_t i_pts, vlc_tick_t i_dts,
@@ -93,8 +87,7 @@ static int DemuxSubPayload( asf_packet_sys_t *p_packetsys,
             {
                 vlc_debug(p_packetsys->logger, "dropping duplicate num %"PRIu32" off %"PRIu32,
                           i_media_object_number , i_media_object_offset);
-                ssize_t skipped = vlc_stream_Read( p_packetsys->s, NULL, i_sub_payload_data_length );
-                return ( skipped >= 0 && (uint32_t) skipped == i_sub_payload_data_length ) ? 0 : -1;
+                return vlc_stream_Read( p_packetsys->s, NULL, i_sub_payload_data_length ) != i_sub_payload_data_length ? -1 : 0;
             }
         }
 
@@ -356,7 +349,11 @@ static int DemuxPayload(asf_packet_sys_t *p_packetsys, asf_packet_t *pkt, int i_
                 goto skip;
         }
 
-        SkipBytes( p_packetsys->s, pkt->i_skip );
+        if (pkt->i_skip && vlc_stream_Read( p_packetsys->s, NULL, pkt->i_skip ) != pkt->i_skip )
+        {
+            vlc_warning( p_packetsys->logger, "unexpected end of file" );
+            return -1;
+        }
 
         vlc_tick_t i_payload_pts;
         i_payload_pts = i_pkt_time + i_pkt_time_delta * i_subpayload_count;
@@ -527,7 +524,7 @@ int DemuxASFPacket( asf_packet_sys_t *p_packetsys,
 
     if( pkt.left > 0 )
     {
-        size_t toskip;
+        uint32_t toskip;
         if( pkt.left > pkt.padding_length &&
             !p_packetsys->b_can_hold_multiple_packets )
         {
@@ -550,14 +547,10 @@ int DemuxASFPacket( asf_packet_sys_t *p_packetsys,
             toskip = pkt.padding_length;
         }
 
-        if( toskip )
+        if( toskip  && vlc_stream_Read( p_packetsys->s, NULL, toskip ) != toskip )
         {
-            i_return = vlc_stream_Read( p_packetsys->s, NULL, toskip );
-            if( i_return < 0 || (size_t) i_return < toskip )
-            {
-                vlc_error( p_packetsys->logger, "cannot skip data, EOF ?" );
-                return 0;
-            }
+            vlc_error( p_packetsys->logger, "cannot skip data, EOF ?" );
+            return 0;
         }
     }
 
@@ -570,8 +563,7 @@ loop_error_recovery:
         vlc_error( p_packetsys->logger, "unsupported packet header, fatal error" );
         return -1;
     }
-    i_return = vlc_stream_Read( p_packetsys->s, NULL, i_data_packet_min );
-    if( i_return <= 0 || (size_t) i_return != i_data_packet_min )
+    if( vlc_stream_Read( p_packetsys->s, NULL, i_data_packet_min ) != i_data_packet_min )
     {
         vlc_warning( p_packetsys->logger, "cannot skip data, EOF ?" );
         return 0;


=====================================
modules/demux/au.c
=====================================
@@ -113,7 +113,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* skip signature */
-    if( vlc_stream_Read( p_demux->s, NULL, 4 ) < 4 )
+    if( vlc_stream_Read( p_demux->s, NULL, 4 ) != 4 )
         return VLC_EGENERIC;
 
     /* read header */
@@ -143,8 +143,8 @@ static int Open( vlc_object_t *p_this )
         if( p_sys->i_header_size > SSIZE_MAX )
             return VLC_EGENERIC;
 #endif
-        size_t skip = p_sys->i_header_size - 24;
-        if( vlc_stream_Read( p_demux->s, NULL, skip ) < (ssize_t)skip )
+        uint32_t skip = p_sys->i_header_size - 24;
+        if( vlc_stream_Read( p_demux->s, NULL, skip ) != skip )
             return VLC_EGENERIC;
     }
 


=====================================
modules/demux/avi/avi.c
=====================================
@@ -332,8 +332,7 @@ static int Open( vlc_object_t * p_this )
         return VLC_EGENERIC;
     }
 
-    if( i_peeker > 0
-     && vlc_stream_Read( p_demux->s, NULL, i_peeker ) < i_peeker )
+    if( i_peeker > 0 && vlc_stream_Read( p_demux->s, NULL, i_peeker ) != i_peeker )
         return VLC_EGENERIC;
 
     /* Initialize input structures. */
@@ -833,7 +832,7 @@ aviindex:
             goto error;
     }
     /* Skip movi header */
-    if( vlc_stream_Read( p_demux->s, NULL, 12 ) < 12 )
+    if( vlc_stream_Read( p_demux->s, NULL, 12 ) != 12 )
         goto error;
 
     p_sys->i_movi_begin = p_movi->i_chunk_pos;
@@ -2225,7 +2224,7 @@ static int AVI_PacketGetHeader( demux_t *p_demux, avi_packet_t *p_pk )
 static int AVI_PacketNext( demux_t *p_demux )
 {
     avi_packet_t    avi_ck;
-    size_t          i_skip = 0;
+    uint32_t        i_skip = 0;
 
     if( AVI_PacketGetHeader( p_demux, &avi_ck ) )
     {
@@ -2252,8 +2251,7 @@ static int AVI_PacketNext( demux_t *p_demux )
     if( i_skip > SSIZE_MAX )
         return VLC_EGENERIC;
 
-    ssize_t i_ret = vlc_stream_Read( p_demux->s, NULL, i_skip );
-    if( i_ret < 0 || (size_t) i_ret != i_skip )
+    if( vlc_stream_Read( p_demux->s, NULL, i_skip ) != i_skip )
     {
         return VLC_EGENERIC;
     }


=====================================
modules/demux/avi/libavi.c
=====================================
@@ -114,12 +114,10 @@ static int AVI_GotoNextChunk( stream_t *s, const avi_chunk_t *p_chk )
     {
         return vlc_stream_Seek( s, i_offset );
     }
-    else
-    {
-        ssize_t i_read = i_offset - vlc_stream_Tell( s );
-        return (i_read >=0 && vlc_stream_Read( s, NULL, i_read ) == i_read) ?
-                    VLC_SUCCESS : VLC_EGENERIC;
-    }
+    ssize_t i_read = i_offset - vlc_stream_Tell( s );
+    if (i_read < 0)
+        return VLC_EGENERIC;
+    return vlc_stream_Read( s, NULL, i_read ) != i_read ? VLC_EGENERIC : VLC_SUCCESS;
 }
 
 static int AVI_NextChunk( stream_t *s, avi_chunk_t *p_chk )


=====================================
modules/demux/caf.c
=====================================
@@ -817,7 +817,7 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    if( vlc_stream_Read( p_demux->s, NULL, 8 ) < 8 )
+    if( vlc_stream_Read( p_demux->s, NULL, 8 ) != 8 )
         return VLC_EGENERIC; /* This would be very strange since we justed peeked at these bytes. */
 
     p_demux->p_sys = calloc( 1, sizeof( demux_sys_t ));


=====================================
modules/demux/dmxmus.c
=====================================
@@ -450,7 +450,7 @@ static int Open(vlc_object_t *obj)
         sys->length = VLC_TICK_INVALID;
         offset -= hdrlen;
 
-        if (vlc_stream_Read(stream, NULL, offset) < (ssize_t)offset)
+        if (vlc_stream_Read(stream, NULL, offset) != offset)
             return VLC_EGENERIC;
     }
 


=====================================
modules/demux/flac.c
=====================================
@@ -705,7 +705,7 @@ static int  ParseHeaders( demux_t *p_demux, es_format_t *p_fmt )
             if( p_fmt->p_extra == NULL )
                 return VLC_EGENERIC;
 
-            if( vlc_stream_Read( p_demux->s, NULL, 4) < 4)
+            if( vlc_stream_Read( p_demux->s, NULL, 4 ) != 4 )
             {
                 FREENULL( p_fmt->p_extra );
                 return VLC_EGENERIC;
@@ -751,7 +751,7 @@ static int  ParseHeaders( demux_t *p_demux, es_format_t *p_fmt )
                 ParsePicture( p_demux, p_peek, i_peek );
         }
 
-        if( vlc_stream_Read( p_demux->s, NULL, 4+i_len ) < 4+i_len )
+        if( vlc_stream_Read( p_demux->s, NULL, 4+i_len ) != (4+i_len) )
             break;
     }
 


=====================================
modules/demux/mjpeg.c
=====================================
@@ -339,7 +339,7 @@ static int Open( vlc_object_t * p_this )
     if( b_matched )
     {
         p_demux->pf_demux = MimeDemux;
-        if( vlc_stream_Read( p_demux->s, NULL, i_size ) < i_size )
+        if( vlc_stream_Read( p_demux->s, NULL, i_size ) != i_size )
             return VLC_EGENERIC;
     }
     else if( i_size == 0 )


=====================================
modules/demux/mp4/libmp4.c
=====================================
@@ -251,13 +251,13 @@ int MP4_Seek( stream_t *p_stream, uint64_t i_pos )
     if ( i_current_pos < 0 || i_pos < (uint64_t)i_current_pos )
         return VLC_EGENERIC;
 
-    size_t i_toread = i_pos - i_current_pos;
+    uint64_t i_toread = i_pos - i_current_pos;
     if( i_toread == 0 )
         return VLC_SUCCESS;
     else if( i_toread > (1<<17) )
         return VLC_EGENERIC;
 
-    if( vlc_stream_Read( p_stream, NULL, i_toread ) != (ssize_t)i_toread )
+    if( vlc_stream_Read( p_stream, NULL, i_toread ) != i_toread )
         return VLC_EGENERIC;
     return VLC_SUCCESS;
 }
@@ -630,7 +630,7 @@ static int MP4_ReadBoxSkip( stream_t *p_stream, MP4_Box_t *p_box )
 
 static int MP4_ReadBox_ilst( stream_t *p_stream, MP4_Box_t *p_box )
 {
-    if( p_box->i_size < 8 || vlc_stream_Read( p_stream, NULL, 8 ) < 8 )
+    if( p_box->i_size < 8 || vlc_stream_Read( p_stream, NULL, 8 ) != 8 )
         return 0;
 
     /* Find our handler */
@@ -3758,7 +3758,7 @@ static int MP4_ReadBox_Metadata( stream_t *p_stream, MP4_Box_t *p_box )
     const uint8_t *p_peek;
     if ( vlc_stream_Peek( p_stream, &p_peek, 16 ) < 16 )
         return 0;
-    if ( vlc_stream_Read( p_stream, NULL, 8 ) < 8 )
+    if ( vlc_stream_Read( p_stream, NULL, 8 ) != 8 )
         return 0;
     const uint32_t stoplist[] = { ATOM_data, 0 };
     return MP4_ReadBoxContainerChildren( p_stream, p_box, stoplist );
@@ -3930,7 +3930,7 @@ static int MP4_ReadBox_TrackReference( stream_t *p_stream, MP4_Box_t *p_box )
 static int MP4_ReadBox_tref( stream_t *p_stream, MP4_Box_t *p_box )
 {
     /* skip header */
-    ssize_t i_header = mp4_box_headersize( p_box );
+    size_t i_header = mp4_box_headersize( p_box );
     if( vlc_stream_Read( p_stream, NULL, i_header ) != i_header )
         return 0;
     /* read each reference atom with forced handler */
@@ -4064,7 +4064,7 @@ static int MP4_ReadBox_meta( stream_t *p_stream, MP4_Box_t *p_box )
         return 0;
 
     /* skip over box header */
-    if( vlc_stream_Read( p_stream, NULL, i_headersize ) < (ssize_t) i_headersize )
+    if( vlc_stream_Read( p_stream, NULL, i_headersize ) != i_headersize )
         return 0;
 
     /* meta content starts with a 4 byte version/flags value (should be 0) */
@@ -4073,7 +4073,7 @@ static int MP4_ReadBox_meta( stream_t *p_stream, MP4_Box_t *p_box )
 
     if( !memcmp( p_peek, "\0\0\0", 4 ) ) /* correct header case */
     {
-        if( vlc_stream_Read( p_stream, NULL, 4 ) < 4 )
+        if( vlc_stream_Read( p_stream, NULL, 4 ) != 4 )
             return 0;
     }
     else if( memcmp( &p_peek[4], "hdlr", 4 ) ) /* Broken, headerless ones */


=====================================
modules/demux/mpeg/ps.c
=====================================
@@ -151,7 +151,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force )
     const uint8_t *p_peek;
     ssize_t i_peek = 0;
     ssize_t i_offset = 0;
-    ssize_t i_skip = 0;
+    uint64_t i_skip = 0;
     unsigned i_max_packets = PS_PACKET_PROBE;
     int format = MPEG_PS;
     int i_mux_rate = 0;
@@ -220,7 +220,7 @@ static int OpenCommon( vlc_object_t *p_this, bool b_force )
         i_offset += i_pessize;
     }
 
-    if( i_skip > 0 && !p_demux->b_preparsing &&
+    if( i_skip && !p_demux->b_preparsing &&
         vlc_stream_Read( p_demux->s, NULL, i_skip ) != i_skip )
         return VLC_EGENERIC;
 
@@ -865,8 +865,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
 static int ps_pkt_resynch( stream_t *s, int format, bool b_pack )
 {
     const uint8_t *p_peek;
-    int     i_peek;
-    int     i_skip;
+    ssize_t      i_peek;
+    unsigned int i_skip;
 
     if( vlc_stream_Peek( s, &p_peek, 4 ) < 4 )
     {
@@ -909,14 +909,14 @@ static int ps_pkt_resynch( stream_t *s, int format, bool b_pack )
             p_peek[3] >= PS_STREAM_ID_END_STREAM &&
             ( !b_pack || p_peek[3] == PS_STREAM_ID_PACK_HEADER ) )
         {
-            return vlc_stream_Read( s, NULL, i_skip ) == i_skip ? 1 : -1;
+            return vlc_stream_Read( s, NULL, i_skip ) != i_skip ? -1 : 1;
         }
 
         p_peek++;
         i_peek--;
         i_skip++;
     }
-    return vlc_stream_Read( s, NULL, i_skip ) == i_skip ? 0 : -1;
+    return vlc_stream_Read( s, NULL, i_skip ) != i_skip ? -1 : 0;
 }
 
 static block_t *ps_pkt_read( stream_t *s )


=====================================
modules/demux/nsv.c
=====================================
@@ -187,7 +187,7 @@ static int Demux( demux_t *p_demux )
         else if( GetWLE( p_peek ) == 0xbeef )
         {
             /* Next frame of the current NSVs chunk */
-            if( vlc_stream_Read( p_demux->s, NULL, 2 ) < 2 )
+            if( vlc_stream_Read( p_demux->s, NULL, 2 ) != 2 )
             {
                 msg_Warn( p_demux, "cannot read" );
                 return VLC_DEMUXER_EOF;
@@ -241,7 +241,7 @@ static int Demux( demux_t *p_demux )
                     if( p_sys->p_sub )
                         es_out_Control( p_demux->out, ES_OUT_SET_ES, p_sys->p_sub );
                 }
-                if( vlc_stream_Read( p_demux->s, NULL, 2 ) < 2 )
+                if( vlc_stream_Read( p_demux->s, NULL, 2 ) != 2 )
                     return VLC_DEMUXER_EOF;
 
                 if( ( p_frame = vlc_stream_Block( p_demux->s, i_aux - 2 ) ) )
@@ -271,7 +271,7 @@ static int Demux( demux_t *p_demux )
             else
             {
                 /* We skip this extra data */
-                if( vlc_stream_Read( p_demux->s, NULL, i_aux ) < i_aux )
+                if( vlc_stream_Read( p_demux->s, NULL, i_aux ) != i_aux )
                 {
                     msg_Warn( p_demux, "cannot read" );
                     return VLC_DEMUXER_EOF;
@@ -464,8 +464,7 @@ static int ReSynch( demux_t *p_demux )
             if( !memcmp( p_peek, "NSVf", 4 )
              || !memcmp( p_peek, "NSVs", 4 ) )
             {
-                if( i_skip > 0
-                 && vlc_stream_Read( p_demux->s, NULL, i_skip ) < i_skip )
+                if( i_skip > 0 && vlc_stream_Read( p_demux->s, NULL, i_skip ) != i_skip )
                     return VLC_EGENERIC;
                 return VLC_SUCCESS;
             }
@@ -473,7 +472,7 @@ static int ReSynch( demux_t *p_demux )
             i_skip++;
         }
 
-        if( vlc_stream_Read( p_demux->s, NULL, i_skip ) < i_skip )
+        if( vlc_stream_Read( p_demux->s, NULL, i_skip ) != i_skip )
             break;
     }
     return VLC_EGENERIC;
@@ -502,8 +501,7 @@ static int ReadNSVf( demux_t *p_demux )
     if( i_header_size > SSIZE_MAX )
         return VLC_EGENERIC;
 #endif
-    if ( vlc_stream_Read( p_demux->s, NULL, i_header_size )
-                                 < (ssize_t)i_header_size )
+    if ( vlc_stream_Read( p_demux->s, NULL, i_header_size ) != i_header_size )
          return VLC_EGENERIC;
     return VLC_SUCCESS;
 }


=====================================
modules/demux/nuv.c
=====================================
@@ -259,8 +259,7 @@ static int Open( vlc_object_t * p_this )
         else
         {
             msg_Warn( p_demux, "unsupported 'D' frame (c=%c)", fh.i_compression );
-            if( vlc_stream_Read( p_demux->s, NULL,
-                                 fh.i_length ) != fh.i_length )
+            if( vlc_stream_Read( p_demux->s, NULL, fh.i_length ) != fh.i_length )
                 goto error;
         }
     }
@@ -380,8 +379,7 @@ static int Demux( demux_t *p_demux )
 
         if( fh.i_type != 'R' && fh.i_length > 0 )
         {
-            if( vlc_stream_Read( p_demux->s, NULL,
-                                 fh.i_length ) != fh.i_length )
+            if( vlc_stream_Read( p_demux->s, NULL, fh.i_length ) != fh.i_length )
                 return VLC_DEMUXER_EGENERIC;
         }
     }
@@ -609,8 +607,7 @@ static int ControlSetPosition(demux_t *p_demux, uint64_t offset, bool b_guess)
 
         if( fh.i_type != 'R' && fh.i_length > 0 )
         {
-            if( vlc_stream_Read( p_demux->s, NULL,
-                                 fh.i_length ) != fh.i_length )
+            if( vlc_stream_Read( p_demux->s, NULL, fh.i_length ) != fh.i_length )
                 return VLC_EGENERIC;
         }
     }


=====================================
modules/demux/playlist/m3u.c
=====================================
@@ -60,7 +60,7 @@ int Import_M3U( vlc_object_t *p_this )
     stream_t *p_stream = (stream_t *)p_this;
     const uint8_t *p_peek;
     ssize_t i_peek;
-    int offset = 0;
+    unsigned int offset = 0;
 
     i_peek = vlc_stream_Peek( p_stream->s, &p_peek, 1024 );
     if( i_peek < 8 )
@@ -109,7 +109,7 @@ int Import_M3U( vlc_object_t *p_this )
     if (!match)
         return VLC_EGENERIC;
 
-    if (offset > 0 && vlc_stream_Read(p_stream->s, NULL, offset) < offset)
+    if (offset && vlc_stream_Read(p_stream->s, NULL, offset) != offset)
         return VLC_EGENERIC;
 
     msg_Dbg( p_stream, "found valid M3U playlist" );


=====================================
modules/demux/pva.c
=====================================
@@ -278,7 +278,7 @@ static int Demux( demux_t *p_demux )
 
         default:
             msg_Warn( p_demux, "unknown id=0x%x", p_peek[2] );
-            if( vlc_stream_Read( p_demux->s, NULL, i_size + 8 ) < i_size + 8 )
+            if( vlc_stream_Read( p_demux->s, NULL, i_size + 8 ) != (i_size + 8) )
                 return VLC_DEMUXER_EOF;
             break;
     }
@@ -377,7 +377,7 @@ static int ReSynch( demux_t *p_demux )
             if( p_peek[0] == 'A' && p_peek[1] == 'V' && p_peek[4] == 0x55 )
             {
                 if( i_skip > 0
-                 && vlc_stream_Read( p_demux->s, NULL, i_skip ) < i_skip )
+                 && vlc_stream_Read( p_demux->s, NULL, i_skip ) != i_skip )
                     return VLC_EGENERIC;
                 return VLC_SUCCESS;
             }
@@ -385,7 +385,7 @@ static int ReSynch( demux_t *p_demux )
             i_skip++;
         }
 
-        if( vlc_stream_Read( p_demux->s, NULL, i_skip ) < i_skip )
+        if( vlc_stream_Read( p_demux->s, NULL, i_skip ) != i_skip )
             break;
     }
 


=====================================
modules/demux/rawvid.c
=====================================
@@ -398,7 +398,7 @@ static int Demux( demux_t *p_demux )
     {
         /* Skip the frame header */
         /* Skip "FRAME" */
-        if( vlc_stream_Read( p_demux->s, NULL, 5 ) < 5 )
+        if( vlc_stream_Read( p_demux->s, NULL, 5 ) != 5 )
             return VLC_DEMUXER_EOF;
         /* Find \n */
         for( ;; )


=====================================
modules/demux/smf.c
=====================================
@@ -555,7 +555,7 @@ static int Open (vlc_object_t *obj)
         uint32_t riff_len = GetDWLE (peek + 4);
 
         msg_Dbg (demux, "detected RIFF MIDI file (%"PRIu32" bytes)", riff_len);
-        if ((vlc_stream_Read (stream, NULL, 12) < 12))
+        if (vlc_stream_Read( stream, NULL, 12 ) != 12 )
             return VLC_EGENERIC;
 
         /* Look for the RIFF data chunk */
@@ -577,7 +577,7 @@ static int Open (vlc_object_t *obj)
             if (!memcmp (chnk_hdr, "data", 4))
                 break; /* found! */
 
-            if (vlc_stream_Read (stream, NULL, chnk_len) < (ssize_t)chnk_len)
+            if (vlc_stream_Read( stream, NULL, chnk_len ) != chnk_len )
                 return VLC_EGENERIC;
         }
 
@@ -640,7 +640,7 @@ static int Open (vlc_object_t *obj)
         return VLC_ENOMEM;
 
     /* We've had a valid SMF header - now skip it*/
-    if (vlc_stream_Read (stream, NULL, 14) < 14)
+    if (vlc_stream_Read( stream, NULL, 14 ) != 14 )
         goto error;
 
     demux->p_sys = sys;


=====================================
modules/demux/ty.c
=====================================
@@ -1661,8 +1661,7 @@ static int parse_master(demux_t *p_demux)
         p_sys->seq_table[j].l_timestamp = U64_AT(&mst_buf[0]);
         if (i_map_size > 8) {
             msg_Err(p_demux, "Unsupported SEQ bitmap size in master chunk");
-            if (vlc_stream_Read(p_demux->s, NULL, i_map_size)
-                                       < (ssize_t)i_map_size)
+            if (vlc_stream_Read(p_demux->s, NULL, i_map_size) != i_map_size )
                 return VLC_EGENERIC;
         } else {
             if (vlc_stream_Read(p_demux->s, mst_buf + 8, i_map_size)


=====================================
modules/demux/voc.c
=====================================
@@ -104,7 +104,7 @@ static int Open( vlc_object_t * p_this )
              i_version & 0xff );
 
     /* skip VOC header */
-    if( vlc_stream_Read( p_demux->s, NULL, i_data_offset ) < i_data_offset )
+    if( vlc_stream_Read( p_demux->s, NULL, i_data_offset ) != i_data_offset )
         return VLC_EGENERIC;
 
     demux_sys_t *p_sys = vlc_obj_malloc( p_this, sizeof (*p_sys) );
@@ -347,7 +347,7 @@ static int ReadBlockHeader( demux_t *p_demux )
             i_block_size -= 12;
 
             if( ( vlc_stream_Read( p_demux->s, buf, 8 ) < 8 )
-             || ( vlc_stream_Read( p_demux->s, NULL, 4 ) < 4 ) )
+             ||  vlc_stream_Read( p_demux->s, NULL, 4 ) != 4 )
                 goto corrupt;
 
             new_fmt.audio.i_rate = GetDWLE( buf );
@@ -419,8 +419,7 @@ static int ReadBlockHeader( demux_t *p_demux )
             /* fall through */
         case 4: /* blocks of non-audio types can be skipped */
         case 5:
-            if( vlc_stream_Read( p_demux->s, NULL,
-                                 i_block_size ) < i_block_size )
+            if(vlc_stream_Read( p_demux->s, NULL, i_block_size ) != i_block_size)
                 goto corrupt;
             i_block_size = 0;
             break;


=====================================
modules/demux/wav.c
=====================================
@@ -185,8 +185,7 @@ static int ChunkSkip( demux_t *p_demux, uint32_t i_size )
                                 vlc_stream_Tell( p_demux->s ) + i_size );
     }
 
-    ssize_t i_ret = vlc_stream_Read( p_demux->s, NULL, i_size );
-    return i_ret < 0 || (size_t) i_ret != i_size ? VLC_EGENERIC : VLC_SUCCESS;
+    return vlc_stream_Read( p_demux->s, NULL, i_size ) != i_size ? VLC_EGENERIC : VLC_SUCCESS;
 }
 
 static int ChunkGetNext( demux_t *p_demux, enum wav_chunk_id *p_id,



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/90722ca1229d7fad6cdb1b5427c0bc0705b0fb1a...daa1e367ca64053c5bc6bdf1d52b02f6e9fd2c41

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/90722ca1229d7fad6cdb1b5427c0bc0705b0fb1a...daa1e367ca64053c5bc6bdf1d52b02f6e9fd2c41
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