Fix oob for zero arg #load_directory

This commit is contained in:
FourteenBrush
2026-08-13 12:51:42 +02:00
committed by GitHub
parent 68bc28e97b
commit 02adbc11e3

View File

@@ -2244,7 +2244,10 @@ gb_internal LoadDirectiveResult check_load_directory_directive(CheckerContext *c
String name = bd->name.string;
GB_ASSERT(name == "load_directory");
if (ce->args.count != 1) {
if (ce->args.count == 0) {
error(ce->close, "'#%.*s' expects 1 argument, got 0", LIT(name));
return LoadDirective_Error;
} else if (ce->args.count != 1) {
error(ce->args[0], "'#%.*s' expects 1 argument, got %td", LIT(name), ce->args.count);
return LoadDirective_Error;
}