[vlc-devel] [PATCH] filter_chain: check filter_owner callbacks

Alexandre Janniaux ajanni at videolabs.io
Tue Jul 28 12:07:45 CEST 2020


sys = chain is guaranteed to be non-null since it's a callback from a
filter_chain_t but the underlying owner can be left zero-initialized in
case there is no decoder device, or dec-dev=none is set so it cannot be
deferenced without checking it first.
---
 src/misc/filter_chain.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 4c2a3c58f9..8221278211 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -107,7 +107,9 @@ static picture_t *filter_chain_VideoBufferNew( filter_t *filter )
 static vlc_decoder_device * filter_chain_HoldDecoderDevice(vlc_object_t *o, void *sys)
 {
     filter_chain_t *chain = sys;
-    if (!chain->parent_video_owner.video->hold_device)
+
+    if (chain->parent_video_owner.video == NULL ||
+        chain->parent_video_owner.video->hold_device == NULL)
         return NULL;
 
     return chain->parent_video_owner.video->hold_device(o, chain->parent_video_owner.sys);
-- 
2.27.0



More information about the vlc-devel mailing list