Fix crash when ONEWAY/CONTRASTS contained an empty list.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 31 Mar 2016 12:44:57 +0000 (14:44 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 31 Mar 2016 13:07:51 +0000 (15:07 +0200)
Found by zzuf.

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

index 9650dc6e6a7c3f14ed5afeb9446dedf6c52e86c1..8d7867234b0ce687a94502dfd990fdb0168c606e 100644 (file)
@@ -545,6 +545,9 @@ cmd_oneway (struct lexer *lexer, struct dataset *ds)
                  goto error;
                }
            }
+         
+         if ( ll_count (coefficient_list) <= 0)
+           goto error;
 
          ll_push_tail (&oneway.contrast_list, &cl->ll);
        }
index 336b328364a63e872419d2839f894857ef2cb57e..a53dfcdd4dea0ae7e285f241c8a58ee4392bedef 100644 (file)
@@ -1008,8 +1008,30 @@ begin data.
 end data.
 
 oneway a"by b.
+
 ])
 
 AT_CHECK([pspp -O format=csv crash5.sps], [1], [ignore])
 
 AT_CLEANUP
+
+
+
+
+AT_SETUP([ONEWAY Crash on unterminated string])
+
+AT_DATA([crash6.sps], [dnl
+DATA LIST NOTABLE LIST /height * weight * temperature * sex *.
+BEGIN DATA.
+1801     .       .     0
+1606     .   0   .     1
+END DATA.
+
+ONEWAY /VARIABLES= height weight temperature BY sex
+ /CONTRAST =" 2 -2  1
+ .
+])
+
+AT_CHECK([pspp -O format=csv crash6.sps], [1], [ignore])
+
+AT_CLEANUP