From: John Darrington Date: Wed, 30 Mar 2016 10:04:54 +0000 (+0200) Subject: Avoid possible memory allocation error on erroneous input. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00a0a46dcdb3bf9e93200a145df94ff24d2d35d4;p=pspp Avoid possible memory allocation error on erroneous input. Valgrind showed a possible problem here. --- diff --git a/src/language/stats/npar.c b/src/language/stats/npar.c index 22d95c025a..7c2b37af15 100644 --- a/src/language/stats/npar.c +++ b/src/language/stats/npar.c @@ -692,8 +692,12 @@ npar_runs (struct lexer *lexer, struct dataset *ds, return 0; } - lex_force_match (lexer, T_RPAREN); - lex_force_match (lexer, T_EQUALS); + if (! lex_force_match (lexer, T_RPAREN)) + return 2; + + if (! lex_force_match (lexer, T_EQUALS)) + return 2; + if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds), &tp->vars, &tp->n_vars, PV_NO_SCRATCH | PV_NO_DUPLICATE | PV_NUMERIC))