Fix crash in ROC command when no valid state variable is given.
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 25 Mar 2016 20:25:49 +0000 (21:25 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 25 Mar 2016 20:25:49 +0000 (21:25 +0100)
Found by zzuf.

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

index d011bf547e7a20fd4ab4acf9699d6e0db941ab99..cf8d9371ca1317ce17397bfbb97afff066a58063 100644 (file)
@@ -108,6 +108,10 @@ cmd_roc (struct lexer *lexer, struct dataset *ds)
     }
 
   roc.state_var = parse_variable (lexer, dict);
+  if (! roc.state_var)
+    {
+      goto error;
+    }
 
   if ( !lex_force_match (lexer, T_LPAREN))
     {
index 7ffb65228826933e1fd02dd430b563bc83f5eb1d..f8d41ba75d93c417e20ebc0b0c6d1ee8a8c9ff05 100644 (file)
@@ -164,3 +164,22 @@ Area,Std. Error,Asymptotic Sig.,Lower Bound,Upper Bound
 .490,.111,.927,.307,.673
 ])
 AT_CLEANUP
+
+
+
+
+AT_SETUP([ROC crash on no state variable])
+AT_DATA([roc.sps], [dnl
+data list notable list /x * y * w * a *.
+begin data.
+5 5 1  0
+end data.
+
+
+roc x y By(a (1)
+ .
+])
+
+AT_CHECK([pspp -o pspp.csv roc.sps], [1], [ignore])
+
+AT_CLEANUP