Fixed crash in error path for GET DATA 20130424010505/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Tue, 23 Apr 2013 17:42:36 +0000 (19:42 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Tue, 23 Apr 2013 17:42:36 +0000 (19:42 +0200)
src/language/data-io/get-data.c
tests/language/data-io/get.at

index 2e7df57f02cc8d7321e7affeb28d1a27f164a86e..321bd887ea3690c91e7b0a916b7cd24f8b10443a 100644 (file)
@@ -57,8 +57,15 @@ static int parse_get_psql (struct lexer *lexer, struct dataset *);
 int
 cmd_get_data (struct lexer *lexer, struct dataset *ds)
 {
-  struct spreadsheet_read_options opts;
   char *tok = NULL;
+  struct spreadsheet_read_options opts;
+  
+  opts.sheet_name = NULL;
+  opts.sheet_index = -1;
+  opts.cell_range = NULL;
+  opts.read_names = false;
+  opts.asw = -1;
+
   lex_force_match (lexer, T_SLASH);
 
   if (!lex_force_match_id (lexer, "TYPE"))
index b9a187f292034cb872516de81ea61862e1fb5c6a..9f49b577447230a17511b40688316112f5c162ab 100644 (file)
@@ -90,3 +90,13 @@ x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w
 GET_KEEP_ALL([uncompressed])
 GET_KEEP_ALL([compressed])
 
+
+dnl Test for a crash when no /TYPE was provided
+AT_SETUP([GET data no type])
+AT_DATA([get.sps], [dnl
+get data /file='anything'.
+])
+
+AT_CHECK([pspp get.sps], [1], [ignore])
+
+AT_CLEANUP