Fix crash in FLIP with no variables.
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 26 Mar 2016 15:57:16 +0000 (16:57 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 26 Mar 2016 15:57:16 +0000 (16:57 +0100)
Found by zzuf.

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

index 68152b1b190b4c90d8754205279f45e623ab75c3..9d3b0a6346cb460484e64286f840647eddef154d 100644 (file)
@@ -144,6 +144,8 @@ cmd_flip (struct lexer *lexer, struct dataset *ds)
            break;
          }
     }
+  if (flip->n_vars <= 0)
+    goto error;
 
   flip->file = pool_create_temp_file (flip->pool);
   if (flip->file == NULL)
index 2b7e234b4244f9812061abdc6979f76e50fc7506..22058f23bf8d5f1cb227036baf3385ea8610958a 100644 (file)
@@ -81,3 +81,20 @@ v9      ,9.00,12.00
 v10     ,10.00,13.00
 ])
 AT_CLEANUP
+
+
+
+
+AT_SETUP([FLIP badly formed])
+
+AT_DATA([flip.sps], [dnl
+data list notable /N 1 (a) a b c d 2-9.
+
+flip newnames=n.
+list.
+flip.
+])
+
+AT_CHECK([pspp -O format=csv flip.sps], [1], [ignore])
+
+AT_CLEANUP