From 4d2e0f5b77f409ac5b864233bcd555e0c167733d Mon Sep 17 00:00:00 2001 From: John Darrington Date: Sat, 26 Mar 2016 18:34:02 +0100 Subject: [PATCH] Fix bug in EXAMINE when an invalid dependent variable was specified. Found by zzuf. --- src/language/stats/examine.c | 3 ++- tests/language/stats/examine.at | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/language/stats/examine.c b/src/language/stats/examine.c index 20cd2f4518..68b6411626 100644 --- a/src/language/stats/examine.c +++ b/src/language/stats/examine.c @@ -1942,7 +1942,8 @@ cmd_examine (struct lexer *lexer, struct dataset *ds) examine.boxplot = false; examine.spreadlevelplot = false; examine.sl_power = 0; - + examine.dep_vars = NULL; + examine.n_dep_vars = 0; examine.dict = dataset_dict (ds); /* Accept an optional, completely pointless "/VARIABLES=" */ diff --git a/tests/language/stats/examine.at b/tests/language/stats/examine.at index d4540ba45d..a55facf7c2 100644 --- a/tests/language/stats/examine.at +++ b/tests/language/stats/examine.at @@ -1046,3 +1046,30 @@ EXAMINE AT_CHECK([pspp -o pspp.csv examine-empty-parens.sps], [1], [ignore]) AT_CLEANUP + + + + +dnl Test for another crash which happened on bad input syntax +AT_SETUP([EXAMINE -- Bad variable]) + +AT_DATA([examine-bad-variable.sps], [dnl +data list list /h * g *. +begin data. +3 1 +4 1 +5 2 +end data. + +EXAMINE + /VARIABLES/ h + BY g + . +]) + +AT_CHECK([pspp -o pspp.csv examine-bad-variable.sps], [1], [ignore]) + +AT_CLEANUP + + + -- 2.30.2