From 5950bc81d20b5b6f9ddf1b34df3141cd542d2c6a Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 6 May 2021 20:29:06 +0200 Subject: [PATCH 1/1] server: Don't crash on blank moods. We special-case empty mood definitions (because we can't map the osl object anyway), but we don't check whether the mood definition contains anything else than whitespace or comments. Such blank mood definitions result in an empty abstract syntax tree indicated by ->ast of the mood parser's context structure being NULL. We happily dereference that pointer in mp_eval_row() and die by the resulting SIGSEGV. The fix is trivial: simply treat blank moods in the same way as the dummy mood, i.e. regard each audio file as admissible. --- mp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mp.c b/mp.c index 56c16e31..416b4f92 100644 --- a/mp.c +++ b/mp.c @@ -541,6 +541,8 @@ bool mp_eval_row(const struct osl_row *aft_row, struct mp_context *ctx) { if (!ctx) /* dummy mood */ return true; + if (!ctx->ast) /* empty mood */ + return true; assert(aft_row); ctx->aft_row = aft_row; ctx->have_afsi = false; -- 2.39.2