Fixed crash parsing NPAR CHISQUARE 20121227030502/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 26 Dec 2012 12:56:30 +0000 (13:56 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 26 Dec 2012 12:56:30 +0000 (13:56 +0100)
src/language/stats/npar.c
tests/language/stats/npar.at

index 737c94e3d2a296dfd4f999dac4e822c5c08e5ea3..fbcdeae058e1dd1c47abc8cdcab01c905496598b 100644 (file)
@@ -830,11 +830,11 @@ npar_chisquare (struct lexer *lexer, struct dataset *ds,
     {
       cstp->ranged = true;
       if ( ! lex_force_num (lexer)) return 0;
-      cstp->lo = lex_integer (lexer);
+      cstp->lo = lex_number (lexer);
       lex_get (lexer);
       lex_force_match (lexer, T_COMMA);
       if (! lex_force_num (lexer) ) return 0;
-      cstp->hi = lex_integer (lexer);
+      cstp->hi = lex_number (lexer);
       if ( cstp->lo >= cstp->hi )
        {
          msg (ME,
index f5eb2a404cc803182e338251244afc2eabf67624..2e5d886f3fe05fdc53013d9f4a788e008df472c6 100644 (file)
@@ -1685,3 +1685,32 @@ Asymp. Sig. (2-tailed),1.000,.414
 
 AT_CLEANUP
 
+
+
+AT_SETUP([NPAR TESTS CHISQUARE crash])
+dnl This syntax had been observed to crash pspp
+
+AT_DATA([npar.sps], [dnl
+data list list /x *.
+begin data.
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+end data.
+
+* This happens to be invalid syntax.  But should not crash.
+NPAR TEST
+       /CHISQUARE= x(0.098, 99.098)
+       /EXPECTED =  1.2.
+])
+
+AT_CHECK([pspp -O format=csv npar.sps], [1], [ignore])
+
+AT_CLEANUP