Fixed crash in T-TEST when a non-number was passed where a number was expected.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 24 Mar 2016 19:30:36 +0000 (20:30 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 24 Mar 2016 21:24:25 +0000 (22:24 +0100)
Found by zzuf.

src/language/stats/t-test-parser.c
tests/language/stats/t-test.at

index 660997e95c25ffa4b7af3c452a7771f8a4f7f80a..bc9de94a4014db42ab3580539d6ed7a22d17d85e 100644 (file)
@@ -80,7 +80,8 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
          mode_count++;
          tt.mode = MODE_SINGLE;
          lex_match (lexer, T_EQUALS);
-         lex_force_num (lexer);
+         if (!lex_force_num (lexer))
+           goto parse_failed;
          testval = lex_number (lexer);
          lex_get (lexer);
        }
@@ -276,7 +277,8 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
          if ( lex_match_id (lexer, "CIN") || lex_force_match_id (lexer, "CI"))
            if ( lex_force_match (lexer, T_LPAREN))
              {
-               lex_force_num (lexer);
+               if (!lex_force_num (lexer))
+                 goto parse_failed;
                tt.confidence = lex_number (lexer);
                lex_get (lexer);
                lex_force_match (lexer, T_RPAREN);
index 0ad76faa53fded93d8d582d8c2adac19b2589a78..455d2889200a32ac3dfbca123ff503bff335b9d3 100644 (file)
@@ -819,3 +819,23 @@ t-test /variables = x group=g(1,3).
 AT_CHECK([pspp t-test-crs.sps], [0],[ignore], [ignore])
 
 AT_CLEANUP
+
+
+
+dnl Tests for a bug assert failed when a non-number was passes as the p value
+AT_SETUP([T-TEST non number p value])
+AT_DATA([t.sps], [dnl
+data list list /age d_frage_1 weight height *.
+begin data.
+1 2 3 1
+4 5 6 2
+end data.
+
+T-TEST /VARIABLES=age weight height
+ /GROUPS=d_frage_1(1,0) /MISSING=ANALYSIS /CRITERIA=CIN(p.95).
+])
+
+AT_CHECK([pspp t.sps], [1],[ignore], [ignore])
+
+AT_CLEANUP
+