QUICK CLUSTER: Fix infinite loop on bad command name.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 30 May 2015 23:13:30 +0000 (16:13 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 30 May 2015 23:13:30 +0000 (16:13 -0700)
Reported by Alan Mead.

src/language/stats/quick-cluster.c
tests/language/stats/quick-cluster.at

index 68b50123144e2b0b10c19d494d2e4b02b32ac430..0c871c8bf2d54849e19d4bbbd0c262b371ff666a 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012, 2015 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -576,6 +576,11 @@ cmd_quick_cluster (struct lexer *lexer, struct dataset *ds)
                 goto error;
            }
        }
+      else
+        {
+          lex_error (lexer, NULL);
+          goto error;
+        }
     }
 
   qc.wv = dict_get_weight (dict);
index 495635b0b8dd1bbb274da18ae3671c946d629b21..b3025651dcc6000da790595a60a82df79a73e265 100644 (file)
@@ -228,4 +228,19 @@ QUICK CLUSTER x y
 
 AT_CHECK([pspp -O format=csv badn.sps], [1], [ignore])
 
-AT_CLEANUP
\ No newline at end of file
+AT_CLEANUP
+
+AT_SETUP([QUICK CLUSTER infinite loop on bad command name])
+AT_DATA([quick-cluster.sps], [dnl
+data list notable list /x y.
+begin data.
+1   2
+1   2.2
+end data.
+
+QUICK CLUSTER x y /UNSUPPORTED.
+])
+AT_CHECK([pspp -O format=csv quick-cluster.sps], [1], [dnl
+quick-cluster.sps:7.20-7.30: error: QUICK CLUSTER: Syntax error at `UNSUPPORTED'.
+])
+AT_CLEANUP