From 14e65c1dacdf2cc41d308cab8d408d8de26fc1c7 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Thu, 11 May 2017 16:38:11 +0200 Subject: [PATCH] DESCRIPTIVES: Fix a bug where the parser could enter an infinite loop --- src/language/stats/descriptives.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/language/stats/descriptives.c b/src/language/stats/descriptives.c index ce47256759..7182049a66 100644 --- a/src/language/stats/descriptives.c +++ b/src/language/stats/descriptives.c @@ -284,7 +284,15 @@ cmd_descriptives (struct lexer *lexer, struct dataset *ds) else if (lex_match_id (lexer, "DEFAULT")) dsc->show_stats |= DEFAULT_STATS; else - dsc->show_stats |= 1ul << (match_statistic (lexer)); + { + enum dsc_statistic s = match_statistic (lexer); + if (s == DSC_NONE ) + { + lex_error (lexer, NULL); + goto error; + } + dsc->show_stats |= 1ul << s; + } lex_match (lexer, T_COMMA); } if (dsc->show_stats == 0) -- 2.30.2