From 5af9fefff63beddb924ef573e39c57030636efc9 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 25 Nov 2019 01:04:38 +0100 Subject: f_output_chain: fix possible crash when changing filters When changing filters at runtime (vf/af commands/properties), this could crash due to a NULL pointer access. The code for comparing the old and new option values (to detect changes) was simply buggy. --- filters/f_output_chain.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/filters/f_output_chain.c b/filters/f_output_chain.c index 69c05ab85f..d353428abc 100644 --- a/filters/f_output_chain.c +++ b/filters/f_output_chain.c @@ -518,8 +518,10 @@ static bool compare_filter(struct m_obj_settings *a, struct m_obj_settings *b) if (a->enabled != b->enabled) return false; - if (!a->attribs || !a->attribs[0]) - return !b->attribs || !b->attribs[0]; + bool a_empty = !a->attribs || !a->attribs[0]; + bool b_empty = !b->attribs || !b->attribs[0]; + if (a_empty || b_empty) + return a_empty == b_empty; for (int n = 0; a->attribs[n] || b->attribs[n]; n++) { if (!a->attribs[n] || !b->attribs[n]) -- cgit v1.2.3