[vlc-devel] [PATCH 2/4] decoder: fix null-deref when there is no input
Thomas Guillem
thomas at gllm.fr
Wed May 29 15:32:56 CEST 2019
It happened when the decoder was created from input_DecoderCreate()
---
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 99d7ef134e..615cc9eab9 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -541,7 +541,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,
@@ -1109,6 +1109,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
@@ -1952,11 +1953,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;
@@ -2087,6 +2089,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input, vlc_es_id_t *id,
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, id, fmt, p_clock,
input_priv(p_input)->p_resource, p_sout );
}
--
2.20.1
More information about the vlc-devel
mailing list