summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-11-25 01:04:38 +0100
committerwm4 <wm4@nowhere>2019-11-25 01:04:38 +0100
commit5af9fefff63beddb924ef573e39c57030636efc9 (patch)
tree1d302957ee2ef83f5e3f24107e0d9a04ec955025
parentd123af34b5a10f4ff6dc011bc462da68c94ef9fa (diff)
downloadmpv-5af9fefff63beddb924ef573e39c57030636efc9.tar.bz2
mpv-5af9fefff63beddb924ef573e39c57030636efc9.tar.xz
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.
-rw-r--r--filters/f_output_chain.c6
1 files 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])