Fix bug in GRAPH when a bad dependent variable was specified.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 26 Mar 2016 16:36:59 +0000 (17:36 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 26 Mar 2016 16:36:59 +0000 (17:36 +0100)
Found by zzuf.

src/language/stats/graph.c
tests/language/stats/graph.at

index 65c03bbf79dc61985332b2f2123198a45d33a2ef..da74afdef4e82c4eb8784bbb538b8757af8df3a1 100644 (file)
@@ -245,6 +245,8 @@ parse_function (struct lexer *lexer, struct graph *graph)
       for (v = 0; v < ag_func[i].arity; ++v)
        {
          graph->dep_vars[v] = parse_variable (lexer, graph->dict);
+         if (! graph->dep_vars[v])
+           goto error;
        }
 
       if (!lex_force_match (lexer, T_RPAREN))
index b08f9f26d9a52b4d540cfb669b888786313e584a..f9daa69cbb2f89d53415021ca2777e7f6d506354 100644 (file)
@@ -307,4 +307,26 @@ GRAPH /BAR = MINIMUM(y) BY z BY y.
 AT_CHECK([pspp -o pspp.pdf barchart.sps], [0], [ignore])
 dnl Ignore output -- this is just a no-crash check.
 
+AT_CLEANUP
+
+
+
+
+
+AT_SETUP([GRAPH buggy syntax])
+
+AT_DATA([barchart.sps], [dnl
+data list notable list /x y z*.
+begin data
+1  1  3
+2  1  4
+10  2  4
+end data.
+
+GRAPH /BAR = MINIMUM({) BY z BY y.
+])
+
+AT_CHECK([pspp -o pspp.pdf barchart.sps], [1], [ignore])
+dnl Ignore output -- this is just a no-crash check.
+
 AT_CLEANUP
\ No newline at end of file