[vlc-commits] decoder: fix NULl deref if picture queued without vout

Rémi Denis-Courmont git at videolan.org
Tue Jan 26 19:29:01 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jan 26 20:07:29 2016 +0200| [b1fbc145fb6ad7cbc60d911903e891bc185df3ec] | committer: Rémi Denis-Courmont

decoder: fix NULl deref if picture queued without vout

(i.e. if vout creation fails)

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

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

diff --git a/src/input/decoder.c b/src/input/decoder.c
index d632064..f3928e8 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -861,8 +861,7 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
     if( p_picture->date <= VLC_TS_INVALID )
     {
         msg_Warn( p_dec, "non-dated video buffer received" );
-        *pi_lost_sum += 1;
-        picture_Release( p_picture );
+        goto discard;
         return 0;
     }
 
@@ -901,6 +900,9 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
     vlc_fifo_Unlock( p_owner->p_fifo );
 
     /* */
+    if( p_vout == NULL )
+        goto discard;
+
     if( p_picture->b_force || p_picture->date > VLC_TS_INVALID )
         /* FIXME: VLC_TS_INVALID -- verify video_output */
     {
@@ -918,12 +920,14 @@ static int DecoderPlayVideo( decoder_t *p_dec, picture_t *p_picture,
             msg_Warn( p_dec, "early picture skipped" );
         else
             msg_Warn( p_dec, "non-dated video buffer received" );
-
-        *pi_lost_sum += 1;
-        picture_Release( p_picture );
+        goto discard;
     }
 
     return 0;
+discard:
+    *pi_lost_sum += 1;
+    picture_Release( p_picture );
+    return 0;
 }
 
 static void DecoderUpdateStatVideo( decoder_t *p_dec, unsigned decoded,



More information about the vlc-commits mailing list