Segfault with passing a program with - using stdin. Using no module with - would reject the program. #1523

This commit is contained in:
Christoffer Lerno
2024-10-06 12:19:06 +02:00
parent 217151be8d
commit 6bbc77a69c
3 changed files with 9 additions and 0 deletions

View File

@@ -46,6 +46,12 @@ static inline bool create_module_or_check_name(CompilationUnit *unit, Path *modu
static bool filename_to_module_in_buffer(const char *path)
{
if (str_eq("<stdin>", path))
{
scratch_buffer_clear();
scratch_buffer_append("stdin_file");
return true;
}
int len = (int)strlen(path);
int last_slash = 0;
int last_dot = -1;

View File

@@ -177,6 +177,7 @@ bool parse_stdin(void)
.name = "stdin",
.file_id = STDIN_FILE_ID,
.full_path = "<stdin>",
.dir_path = "",
};
#define BUF_SIZE 65536
char buffer[BUF_SIZE];