[vlc-commits] demux: libasf: check reads
Francois Cartegnie
git at videolan.org
Mon Feb 13 17:23:11 CET 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 13 17:04:56 2017 +0100| [af10369e103ea01cc4b1e2631190d5a8cc4084e7] | committer: Francois Cartegnie
demux: libasf: check reads
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=af10369e103ea01cc4b1e2631190d5a8cc4084e7
---
modules/demux/asf/asf.c | 3 ++-
modules/demux/asf/libasf.c | 11 ++++++++---
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules/demux/asf/asf.c b/modules/demux/asf/asf.c
index edc2c04..db99029 100644
--- a/modules/demux/asf/asf.c
+++ b/modules/demux/asf/asf.c
@@ -1192,7 +1192,8 @@ static int DemuxInit( demux_t *p_demux )
}
/* go to first packet */
- vlc_stream_Seek( p_demux->s, p_sys->i_data_begin );
+ if( vlc_stream_Seek( p_demux->s, p_sys->i_data_begin ) != VLC_SUCCESS )
+ goto error;
/* try to calculate movie time */
if( p_sys->p_fp->i_data_packets_count > 0 )
diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c
index ee52b09..edcfcde 100644
--- a/modules/demux/asf/libasf.c
+++ b/modules/demux/asf/libasf.c
@@ -202,8 +202,8 @@ static int ASF_ReadObject_Header( stream_t *s, asf_object_t *p_obj )
p_hdr->i_reserved2 );
#endif
- /* Cannot fail as peek succeed */
- vlc_stream_Read( s, NULL, 30 );
+ if( vlc_stream_Read( s, NULL, 30 ) != 30 )
+ return VLC_EGENERIC;
/* Now load sub object */
for( ; ; )
@@ -507,7 +507,12 @@ static int ASF_ReadObject_header_extension( stream_t *s, asf_object_t *p_obj )
if( !p_he->i_header_extension_size ) return VLC_SUCCESS;
/* Read the extension objects */
- vlc_stream_Read( s, NULL, 46 );
+ if( vlc_stream_Read( s, NULL, 46 ) != 46 )
+ {
+ free( p_he->p_header_extension_data );
+ return VLC_EGENERIC;
+ }
+
for( ; ; )
{
asf_object_t *p_obj = malloc( sizeof( asf_object_t ) );
More information about the vlc-commits
mailing list