From: John Darrington Date: Sat, 26 Mar 2016 15:13:50 +0000 (+0100) Subject: Fixed crash in MODIFY OUTPUT when no valid FORMAT clause was specified. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ecf2cf3b503970ea949bd908cfb357d4f737599;p=pspp Fixed crash in MODIFY OUTPUT when no valid FORMAT clause was specified. Found by zzuf. --- diff --git a/src/language/utilities/output.c b/src/language/utilities/output.c index ac60663909..fc390992b9 100644 --- a/src/language/utilities/output.c +++ b/src/language/utilities/output.c @@ -93,6 +93,7 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) os = &output_specs[n_os - 1]; os->n_rc = 0; os->rc = NULL; + bool format = false; while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD) @@ -153,20 +154,21 @@ cmd_output (struct lexer *lexer, struct dataset *ds UNUSED) fmt.d = decimals; os->fmt = fmt; + format = true; } else { lex_error (lexer, NULL); goto error; - } } + if (!format) + goto error; } else { lex_error (lexer, NULL); goto error; - } } diff --git a/tests/output/tables.at b/tests/output/tables.at index 10b321a4e2..1a7727fc2e 100644 --- a/tests/output/tables.at +++ b/tests/output/tables.at @@ -1,6 +1,6 @@ AT_BANNER([output -- tables]) -AT_SETUP([precision]) +AT_SETUP([OUTPUT precision]) AT_DATA([prec.sps], [[ data list notable list /A * B *. @@ -61,3 +61,27 @@ Pair 1,A - B,-2.00,.94,.42,-3.16,-.84,-4.78,4,.00877 ]) AT_CLEANUP + + + + +AT_SETUP([OUTPUT crash]) + +AT_DATA([prec.sps], [[ +data list notable list /A * B *. +begin data. +2.0 3.0 +1.0 2.0 +end data. + +OUTPUT MODIFY + /SELECT TABLES + /TABLECELLS SELECT = [ SIGNIFICANCE ] + "FORMAT = F/1. + +t-test /PAIRS a with b (PAIRED). +]]) + +AT_CHECK([pspp -O format=csv prec.sps], [1], [ignore]) + +AT_CLEANUP \ No newline at end of file