From 520f53019841067fa441124ccb0d5b893b863752 Mon Sep 17 00:00:00 2001 From: Martijn Dekker Date: Tue, 30 Nov 2021 21:43:50 +0100 Subject: [PATCH] lex.c: add default, though it should never happen (re: b0282f26) If a bug is ever introduced that causes a [[ ... ]] operator to be unhandled by the linter, we should at least avoid writing random memory contents to standard error. In non-release builds, let's abort() so the problem can be more easily backtraced. --- src/cmd/ksh93/sh/lex.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cmd/ksh93/sh/lex.c b/src/cmd/ksh93/sh/lex.c index b77577b87..d04a73927 100644 --- a/src/cmd/ksh93/sh/lex.c +++ b/src/cmd/ksh93/sh/lex.c @@ -1411,6 +1411,13 @@ breakloop: case TEST_GE: alt = ">="; /* '-ge' --> '>=' */ break; + default: +#if _AST_ksh_release + alt = NIL(char*); /* output '(null)' (should never happen) */ +#else + abort(); +#endif + break; } errormsg(SH_DICT, ERROR_warn(0), e_lexobsolete4, shp->inlineno, state, alt);