[vlc-commits] es_out: check p_pgrm before checking visibility
Alexandre Janniaux
git at videolan.org
Tue Mar 24 16:36:21 CET 2020
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Sat Mar 21 18:57:48 2020 +0100| [0a21dc64004c5fe18dd08f87a33f67490f847e05] | committer: Alexandre Janniaux
es_out: check p_pgrm before checking visibility
If EsOutProgramDel is called before EsOutProgramAdd with the program
being currently selected, EsOutProgramAdd will call
EsOutProgramIsVisible with p_sys->p_pgrm == NULL and accessing source
just below will lead to UB/crash.
Regression from 8c9623b6c92a94191afdb7082f3a4bd5ea4995f0.
Note that the behaviour is slightly different from the previous
behaviour, as it will now return false if no program is selected.
Co-authored-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0a21dc64004c5fe18dd08f87a33f67490f847e05
---
src/input/es_out.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index d6fa3e41e7..8d45a6c2c8 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -1250,6 +1250,10 @@ static inline bool EsOutIsGroupSticky( es_out_t *p_out, input_source_t *source,
static bool EsOutIsProgramVisible( es_out_t *out, input_source_t *source, int i_group )
{
es_out_sys_t *p_sys = container_of(out, es_out_sys_t, out);
+
+ if (p_sys->p_pgrm == NULL)
+ return false;
+
return p_sys->i_group_id == 0
|| (p_sys->i_group_id == i_group && p_sys->p_pgrm->source == source);
}
More information about the vlc-commits
mailing list