[vlc-commits] avi: handle I/O errors in probe
Rémi Denis-Courmont
git at videolan.org
Fri Jul 7 22:58:10 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jul 7 23:56:20 2017 +0300| [43b43c74709df7262e8525466ffc6e889bd31bab] | committer: Rémi Denis-Courmont
avi: handle I/O errors in probe
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43b43c74709df7262e8525466ffc6e889bd31bab
---
modules/demux/avi/avi.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 189477079f..c508e20c0f 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -290,6 +290,10 @@ 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 )
+ return VLC_EGENERIC;
+
/* Initialize input structures. */
p_sys = p_demux->p_sys = calloc( 1, sizeof(demux_sys_t) );
if( unlikely(!p_sys) )
@@ -308,11 +312,6 @@ static int Open( vlc_object_t * p_this )
p_sys->b_interleaved = var_InheritBool( p_demux, "avi-interleaved" );
- if( i_peeker > 0 )
- {
- vlc_stream_Read( p_demux->s, NULL, i_peeker );
- }
-
if( AVI_ChunkReadRoot( p_demux->s, &p_sys->ck_root ) )
{
msg_Err( p_demux, "avi module discarded (invalid file)" );
@@ -844,10 +843,12 @@ aviindex:
if( p_sys->b_seekable )
{
/* we have read all chunk so go back to movi */
- vlc_stream_Seek( p_demux->s, p_movi->i_chunk_pos );
+ if( vlc_stream_Seek( p_demux->s, p_movi->i_chunk_pos ) )
+ goto error;
}
/* Skip movi header */
- vlc_stream_Read( p_demux->s, NULL, 12 );
+ if( vlc_stream_Read( p_demux->s, NULL, 12 ) < 12 )
+ goto error;
p_sys->i_movi_begin = p_movi->i_chunk_pos;
return VLC_SUCCESS;
More information about the vlc-commits
mailing list