mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Segfault with passing a program with - using stdin. Using no module with - would reject the program. #1523
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user