Fixed a bug where INSERT would crash when an unterminated string was given.
authorJohn Darrington <john@darrington.wattle.id.au>
Thu, 31 Mar 2016 06:22:44 +0000 (08:22 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Thu, 31 Mar 2016 17:37:27 +0000 (19:37 +0200)
Found by zzuf.

src/language/utilities/include.c
tests/language/utilities/insert.at

index 2c0f3ae8cc74c9bf530f14013fcaf2423f7baba8..473f67513072485ce153c753f80134fcfa13fed3 100644 (file)
@@ -62,6 +62,9 @@ do_insert (struct lexer *lexer, struct dataset *ds, enum variant variant)
     return CMD_FAILURE;
 
   relative_name = utf8_to_filename (lex_tokcstr (lexer)); 
+  if (NULL == relative_name)
+    return CMD_FAILURE;
+   
   filename = include_path_search (relative_name);
   free (relative_name);
 
index e8e76502da5a4ca621f343ba16795ad06f4ffd05..8ae9f3eb5196cb2744efd00e26a41b9ab4282392 100644 (file)
@@ -181,3 +181,16 @@ ONE
 Äpfelfölfaß
 ])
 AT_CLEANUP
+
+
+
+
+dnl Test for a bug where insert crashed on an unterminated string input
+AT_SETUP([INSERT unterminated string])
+
+AT_DATA([insert.sps], [INSERT FILE=7bar.sps' CD=NO.
+])
+
+AT_CHECK([pspp -O format=csv insert.sps], [1], [ignore])
+
+AT_CLEANUP