Fixed bug which caused a crash in GET DATA
authorJohn Darrington <john@darrington.wattle.id.au>
Fri, 12 May 2017 15:03:06 +0000 (17:03 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Fri, 12 May 2017 15:03:06 +0000 (17:03 +0200)
src/language/data-io/get-data.c
tests/language/data-io/get-data-txt.at

index a0608f6dd3724ae172b6298b9cefda89f8316956..dff449851bd91ff8a5bc3b3b18a26b196242f603 100644 (file)
@@ -599,7 +599,13 @@ parse_get_txt (struct lexer *lexer, struct dataset *ds)
           lex_get (lexer);
         }
 
-      name = xstrdup (lex_tokcstr (lexer));
+      const char * tstr = lex_tokcstr (lexer);
+      if (tstr == NULL)
+       {
+         lex_error (lexer, NULL);
+         goto error;
+       }
+      name = xstrdup (tstr);
       if (!lex_force_id (lexer)
           || !dict_id_is_valid (dict, name, true))
        {
index 53f5d4fddc26b83645ff26314c96a8b4939d7c7f..3b45f4c2c0e5483442ea52b507b5d7925450b5a8 100644 (file)
@@ -380,3 +380,24 @@ foo,title,last
 AT_CLEANUP
 
 
+
+AT_SETUP([GET DATA /TYPE=txt another bug])
+
+AT_DATA([crash.sps], [dnl
+get data /type=txt /file=inline /variables=C f7.2 D f7>2.
+begin data.
+3 2
+4 2
+5 2
+end data.
+])
+
+AT_CHECK([pspp -O format=csv crash.sps], [1], [ignore])
+
+AT_CLEANUP
+
+
+
+
+
+