[vlc-commits] decoder: fix null deref when draining (cid #1400441)

Thomas Guillem git at videolan.org
Mon Feb 13 09:35:31 CET 2017


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Feb 13 09:33:44 2017 +0100| [c0ec45e62bf14ffdb45537f217d6d4122496fab5] | committer: Thomas Guillem

decoder: fix null deref when draining (cid #1400441)

Recent regression introduced by c4aabc5.

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

 src/input/decoder.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 0a53840..91a6f37 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -1318,6 +1318,7 @@ static void DecoderProcess( decoder_t *p_dec, block_t *p_block )
             goto error;
     }
 
+    bool packetize = p_owner->p_packetizer != NULL;
     if( p_block )
     {
         if( p_block->i_buffer <= 0 )
@@ -1326,6 +1327,11 @@ static void DecoderProcess( decoder_t *p_dec, block_t *p_block )
         vlc_mutex_lock( &p_owner->lock );
         DecoderUpdatePreroll( &p_owner->i_preroll_end, p_block );
         vlc_mutex_unlock( &p_owner->lock );
+        if( unlikely( p_block->i_flags & BLOCK_FLAG_CORE_PRIVATE_RELOADED ) )
+        {
+            /* This block has already been packetized */
+            packetize = false;
+        }
     }
 
 #ifdef ENABLE_SOUT
@@ -1335,8 +1341,7 @@ static void DecoderProcess( decoder_t *p_dec, block_t *p_block )
         return;
     }
 #endif
-    if( p_owner->p_packetizer
-     && !unlikely( p_block->i_flags & BLOCK_FLAG_CORE_PRIVATE_RELOADED ) )
+    if( packetize )
     {
         block_t *p_packetized_block;
         block_t **pp_block = p_block ? &p_block : NULL;



More information about the vlc-commits mailing list