From: Andre Noll Date: Thu, 6 May 2021 18:29:06 +0000 (+0200) Subject: server: Don't crash on blank moods. X-Git-Tag: v0.6.4~25 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=5950bc81d20b5b6f9ddf1b34df3141cd542d2c6a;hp=3ccea2ef0eff8e9acc5d34528645d3e29bc9a4f9 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. --- 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;