Fix crash in T-Test after parsing a null terminated string.
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 4 Apr 2016 11:42:21 +0000 (13:42 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 4 Apr 2016 11:42:21 +0000 (13:42 +0200)
Found by zzuf.

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

index 7af0dfc9c606b24f72e8c5be5d44327732f78db2..38e58ce01a299c9ed8a194004f68f77727fa9329 100644 (file)
@@ -44,9 +44,9 @@ cmd_t_test (struct lexer *lexer, struct dataset *ds)
 
   /* Variables pertaining to the paired mode */
   const struct variable **v1 = NULL;
-  size_t n_v1;
+  size_t n_v1 = 0;
   const struct variable **v2 = NULL;
-  size_t n_v2;
+  size_t n_v2 = 0;
          
   size_t n_pairs = 0;
   vp *pairs = NULL;
index 455d2889200a32ac3dfbca123ff503bff335b9d3..1203a5f39355967fb8522c7c5539677e62256eb5 100644 (file)
@@ -839,3 +839,29 @@ AT_CHECK([pspp t.sps], [1],[ignore], [ignore])
 
 AT_CLEANUP
 
+
+
+dnl Another crash on invalid input
+AT_SETUP([T-TEST unterminated string - paired])
+AT_DATA([t.sps], [dnl
+data list list /id * a * b * c * d *.
+begin data.
+5 2.0 3.0 4.0 4.0
+3 1.0 2.0 5.1 3.9
+3 2.0 4.5 5.2(3.8
+4 2.0 4.5 5n3 3.7
+5 3.0 6.0 5.9 3.6
+6 3.4 6.0 5.9  .
+end data.
+
+
+t-test /MISSING=listwise /PAIRS a"b with c d (PA       RED).
+])
+
+AT_CHECK([pspp t.sps],[1],[ignore],[ignore])
+
+AT_CLEANUP
+
+
+
+