[vlc-commits] nsv: missing checks for I/O errors

Rémi Denis-Courmont git at videolan.org
Thu Feb 5 21:40:59 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Feb  5 20:31:08 2015 +0200| [50cfb120b2ba08989dec13b5e47bce313517ea15] | committer: Rémi Denis-Courmont

nsv: missing checks for I/O errors

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=50cfb120b2ba08989dec13b5e47bce313517ea15
---

 modules/demux/nsv.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/modules/demux/nsv.c b/modules/demux/nsv.c
index 049b068..b9b3585 100644
--- a/modules/demux/nsv.c
+++ b/modules/demux/nsv.c
@@ -406,17 +406,14 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
  *****************************************************************************/
 static int ReSynch( demux_t *p_demux )
 {
-    const uint8_t *p_peek;
-    int      i_skip;
-    int      i_peek;
-
-    while( vlc_object_alive (p_demux) )
+    for( ;; )
     {
-        if( ( i_peek = stream_Peek( p_demux->s, &p_peek, 1024 ) ) < 8 )
-        {
-            return VLC_EGENERIC;
-        }
-        i_skip = 0;
+        const uint8_t *p_peek;
+        int i_peek = stream_Peek( p_demux->s, &p_peek, 1024 );
+        if( i_peek < 8 )
+            break;
+
+        int i_skip = 0;
 
         while( i_skip < i_peek - 4 )
         {
@@ -433,7 +430,8 @@ static int ReSynch( demux_t *p_demux )
             i_skip++;
         }
 
-        stream_Read( p_demux->s, NULL, i_skip );
+        if( stream_Read( p_demux->s, NULL, i_skip ) < i_skip )
+            break;
     }
     return VLC_EGENERIC;
 }



More information about the vlc-commits mailing list