[vlc-commits] au: handle vlc_stream_Read() errors

Rémi Denis-Courmont git at videolan.org
Tue Feb 7 22:16:05 CET 2017


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb  7 23:15:07 2017 +0200| [cdd2c8a310f1199cda14d310080a1e339eeb6ed6] | committer: Rémi Denis-Courmont

au: handle vlc_stream_Read() errors

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

 modules/demux/au.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/demux/au.c b/modules/demux/au.c
index 411333b..6a92b65 100644
--- a/modules/demux/au.c
+++ b/modules/demux/au.c
@@ -29,6 +29,7 @@
 # include "config.h"
 #endif
 
+#include <limits.h>
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_demux.h>
@@ -115,7 +116,8 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
 
     /* skip signature */
-    vlc_stream_Read( p_demux->s, NULL, 4 );   /* cannot fail */
+    if( vlc_stream_Read( p_demux->s, NULL, 4 ) < 4 )
+        return VLC_EGENERIC;
 
     /* read header */
     if( vlc_stream_Read( p_demux->s, hdr, 20 ) < 20 )
@@ -137,7 +139,13 @@ static int Open( vlc_object_t *p_this )
     /* skip extra header data */
     if( p_sys->i_header_size > 24 )
     {
-        vlc_stream_Read( p_demux->s, NULL, p_sys->i_header_size - 24 );
+#if (SSIZE_MAX <= INT32_MAX)
+        if( p_sys->i_header_size > SSIZE_MAX )
+            return VLC_EGENERIC;
+#endif
+        size_t skip = p_sys->i_header_size - 24;
+        if( vlc_stream_Read( p_demux->s, NULL, skip ) < (ssize_t)skip )
+            return VLC_EGENERIC;
     }
 
     /* init fmt */



More information about the vlc-commits mailing list