[vlc-commits] pva: missing checks for I/O error

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:36:18 2015 +0200| [ce799fe39b9e9d34c1d2dd3421fe9a3b655e30aa] | committer: Rémi Denis-Courmont

pva: missing checks for I/O error

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

 modules/demux/pva.c |   27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/modules/demux/pva.c b/modules/demux/pva.c
index 0608644..4c9db0e 100644
--- a/modules/demux/pva.c
+++ b/modules/demux/pva.c
@@ -349,33 +349,30 @@ 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 - 5 )
         {
             if( p_peek[0] == 'A' && p_peek[1] == 'V' && p_peek[4] == 0x55 )
             {
-                if( i_skip > 0 )
-                {
-                    stream_Read( p_demux->s, NULL, i_skip );
-                }
+                if( i_skip > 0
+                 && stream_Read( p_demux->s, NULL, i_skip ) < i_skip )
+                    return VLC_EGENERIC;
                 return VLC_SUCCESS;
             }
             p_peek++;
             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