[vlc-commits] nsv: handle I/O errors
Rémi Denis-Courmont
git at videolan.org
Fri Jul 7 22:46:56 CEST 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jul 7 23:46:53 2017 +0300| [43fa87120ca007f7a43f421d29f70daeba1b8738] | committer: Rémi Denis-Courmont
nsv: handle I/O errors
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=43fa87120ca007f7a43f421d29f70daeba1b8738
---
modules/demux/nsv.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index 40f9eb7ea0..a30667da65 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -238,7 +238,8 @@ static int Demux( demux_t *p_demux )
p_sys->p_sub = es_out_Add( p_demux->out, &p_sys->fmt_sub );
es_out_Control( p_demux->out, ES_OUT_SET_ES, p_sys->p_sub );
}
- vlc_stream_Read( p_demux->s, NULL, 2 );
+ if( vlc_stream_Read( p_demux->s, NULL, 2 ) < 2 )
+ return 0;
if( ( p_frame = vlc_stream_Block( p_demux->s, i_aux - 2 ) ) )
{
@@ -297,7 +298,8 @@ static int Demux( demux_t *p_demux )
if( p_sys->fmt_audio.i_codec == VLC_FOURCC( 'a', 'r', 'a', 'w' ) )
{
uint8_t h[4];
- vlc_stream_Read( p_demux->s, h, 4 );
+ if( vlc_stream_Read( p_demux->s, h, 4 ) < 4 )
+ return 0;
p_sys->fmt_audio.audio.i_channels = h[1];
p_sys->fmt_audio.audio.i_rate = GetWLE( &h[2] );
@@ -439,10 +441,9 @@ 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 );
- }
+ if( i_skip > 0
+ && vlc_stream_Read( p_demux->s, NULL, i_skip ) )
+ return VLC_EGENERIC;
return VLC_SUCCESS;
}
p_peek++;
More information about the vlc-commits
mailing list