From: John Darrington Date: Thu, 11 May 2017 14:38:11 +0000 (+0200) Subject: DESCRIPTIVES: Fix a bug where the parser could enter an infinite loop X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;ds=sidebyside;h=14e65c1dacdf2cc41d308cab8d408d8de26fc1c7;p=pspp DESCRIPTIVES: Fix a bug where the parser could enter an infinite loop --- 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)