[vlc-commits] se/archive: protect paths relying on p_sys->p_entry != NULL

Filip Roséen git at videolan.org
Fri Mar 17 19:05:42 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Fri Mar 17 03:22:14 2017 +0100| [028ade572cf0d702e886c8c927bf73b5d9070ef3] | committer: Jean-Baptiste Kempf

se/archive: protect paths relying on p_sys->p_entry != NULL

The following paths will stumble into undefined-behavior land if
p_sys->p_entry is NULL.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/stream_extractor/archive.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/stream_extractor/archive.c b/modules/stream_extractor/archive.c
index 086f137..88af35a 100644
--- a/modules/stream_extractor/archive.c
+++ b/modules/stream_extractor/archive.c
@@ -484,6 +484,9 @@ static int Control( stream_extractor_t* p_extractor, int i_query, va_list args )
             break;
 
         case STREAM_GET_SIZE:
+            if( p_sys->p_entry == NULL )
+                return VLC_EGENERIC;
+
             *va_arg( args, uint64_t* ) = archive_entry_size( p_sys->p_entry );
             break;
 
@@ -543,7 +546,7 @@ static ssize_t Read( stream_extractor_t *p_extractor, void* p_data, size_t i_siz
     libarchive_t* p_arc = p_sys->p_archive;
     ssize_t       i_ret;
 
-    if( p_sys->b_dead )
+    if( p_sys->b_dead || p_sys->p_entry == NULL )
         return 0;
 
     i_ret = archive_read_data( p_arc,



More information about the vlc-commits mailing list