[vlc-commits] decoder: fix null-deref when there is no input

Thomas Guillem git at videolan.org
Fri May 31 09:53:54 CEST 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed May 29 15:27:14 2019 +0200| [6d31558cbac964a7df233946d2ef4ed5dc20f5ec] | committer: Thomas Guillem

decoder: fix null-deref when there is no input

It happened when the decoder was created from input_DecoderCreate()

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

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

diff --git a/src/input/decoder.c b/src/input/decoder.c
index e5bc84d091..b7589a7d3c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -540,7 +540,7 @@ static int vout_update_format( decoder_t *p_dec )
                 .dpb_size = dpb_size + p_dec->i_extra_picture_buffers + 1,
                 .mouse_event = MouseEvent, .mouse_opaque = p_dec
             } );
-        if (p_vout)
+        if (p_vout && p_owner->p_input)
             input_SendEventVout(p_owner->p_input,
                 &(struct vlc_input_event_vout) {
                     .action = VLC_INPUT_EVENT_VOUT_ADDED,
@@ -1108,6 +1108,7 @@ static void DecoderQueueThumbnail( decoder_t *p_dec, picture_t *p_pic )
     struct decoder_owner *p_owner = dec_get_owner( p_dec );
     if( p_owner->b_first )
     {
+        assert(p_owner->p_input);
         input_SendEvent(p_owner->p_input, &(struct vlc_input_event) {
             .type = INPUT_EVENT_THUMBNAIL_READY,
             .thumbnail = p_pic
@@ -1950,11 +1951,12 @@ static void DeleteDecoder( decoder_t * p_dec )
                 /* Reset the cancel state that was set before joining the decoder
                  * thread */
                 vout_Cancel(vout, false);
-                input_SendEventVout(p_owner->p_input,
-                    &(struct vlc_input_event_vout) {
-                        .action = VLC_INPUT_EVENT_VOUT_DELETED,
-                        .vout = vout,
-                    });
+                if (p_owner->p_input)
+                    input_SendEventVout(p_owner->p_input,
+                        &(struct vlc_input_event_vout) {
+                            .action = VLC_INPUT_EVENT_VOUT_DELETED,
+                            .vout = vout,
+                        });
                 input_resource_PutVout(p_owner->p_resource, vout);
             }
             break;
@@ -2085,6 +2087,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
                              es_format_t *fmt, vlc_clock_t *p_clock,
                              sout_instance_t *p_sout  )
 {
+    assert(p_input);
     return decoder_New( VLC_OBJECT(p_input), p_input, fmt, p_clock,
                         input_priv(p_input)->p_resource, p_sout );
 }



More information about the vlc-commits mailing list