Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/parse/auto_dup.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn void auto_dup_go(u64 loc, u32 lvl, u32 base, u32 *use, u32 n, u32 lab, u8 tgt
}

// Shift outer refs
if ((tg == BJV || tg == BJ0 || tg == BJ1) && vl > base) {
if ((tg == BJV || tg == BJ0 || tg == BJ1 || tg == BJM) && vl > base) {
HEAP[loc] = term_new(0, tg, term_ext(t), vl + n);
return;
}
Expand Down
6 changes: 5 additions & 1 deletion clang/parse/include.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ fn void parse_include(PState *s) {
if (PARSE_SEEN_FILES_LEN >= 1024) {
sys_error("MAX_INCLUDES");
}
PARSE_SEEN_FILES[PARSE_SEEN_FILES_LEN++] = strdup(path);
char *path_copy = strdup(path);
if (!path_copy) {
sys_error("out of memory in parse_include");
}
PARSE_SEEN_FILES[PARSE_SEEN_FILES_LEN++] = path_copy;

// Read and parse
char *src = sys_file_read(path);
Expand Down
3 changes: 3 additions & 0 deletions clang/parse/term/str.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ fn Term parse_term_str(PState *s, u32 depth) {
} else {
c = parse_utf8(s);
}
if (n >= 4096) {
parse_error(s, "string too long (max 4096 codepoints)", '"');
}
cs[n++] = c;
}
parse_advance(s);
Expand Down
3 changes: 3 additions & 0 deletions clang/table/find.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ fn u32 table_find(const char *name, u32 len) {
// Not found - create new entry
u32 id = TABLE_LEN++;
char *copy = malloc(len + 1);
if (!copy) {
sys_error("out of memory in table_find");
}
memcpy(copy, name, len);
copy[len] = '\0';
TABLE[id] = copy;
Expand Down