commit c46b50d2a1aa81e5457a61a5b3814e5a560e68d6
Author: Ian Barwick <barwick@gmail.com>
Date:   Tue Jul 16 00:01:20 2019 +0900

    Explicitly disallow empty "include" directives
    
    For "include" and "include_if_exists", provision of an empty value
    resulted in a rather cryptic "input in flex scanner failed" error being
    reported.
    
    For "include_dir", provision of an empty value would result in all
    configuration files in the same directory as the current file being
    parsed, probably resulting in circular inclusion.

diff --git a/src/backend/utils/misc/guc-file.l b/src/backend/utils/misc/guc-file.l
index 1c8b5f7d84..807d950291 100644
--- a/src/backend/utils/misc/guc-file.l
+++ b/src/backend/utils/misc/guc-file.l
@@ -782,10 +782,17 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
 			 * An include_dir directive isn't a variable and should be
 			 * processed immediately.
 			 */
-			if (!ParseConfigDirectory(opt_value,
-									  config_file, ConfigFileLineno - 1,
-									  depth + 1, elevel,
-									  head_p, tail_p))
+			if (opt_value[0] == '\0')
+			{
+				record_config_file_error("\"include_dir\" must not be empty",
+										 config_file, ConfigFileLineno - 1,
+										 head_p, tail_p);
+				OK = false;
+			}
+			else if (!ParseConfigDirectory(opt_value,
+										   config_file, ConfigFileLineno - 1,
+										   depth + 1, elevel,
+										   head_p, tail_p))
 				OK = false;
 			yy_switch_to_buffer(lex_buffer);
 			pfree(opt_name);
@@ -797,7 +804,14 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
 			 * An include_if_exists directive isn't a variable and should be
 			 * processed immediately.
 			 */
-			if (!ParseConfigFile(opt_value, false,
+			if (opt_value[0] == '\0')
+			{
+				record_config_file_error("\"include_if_exists\" must not be empty",
+										 config_file, ConfigFileLineno - 1,
+										 head_p, tail_p);
+				OK = false;
+			}
+			else if (!ParseConfigFile(opt_value, false,
 								 config_file, ConfigFileLineno - 1,
 								 depth + 1, elevel,
 								 head_p, tail_p))
@@ -812,7 +826,14 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
 			 * An include directive isn't a variable and should be processed
 			 * immediately.
 			 */
-			if (!ParseConfigFile(opt_value, true,
+			if (opt_value[0] == '\0')
+			{
+				record_config_file_error("\"include\" must not be empty",
+										 config_file, ConfigFileLineno - 1,
+										 head_p, tail_p);
+				OK = false;
+			}
+			else if (!ParseConfigFile(opt_value, true,
 								 config_file, ConfigFileLineno - 1,
 								 depth + 1, elevel,
 								 head_p, tail_p))
