Merge pull request #7329 from FourteenBrush/patch-8

Fix out of bounds for zero arg `#load_directory`
This commit is contained in:
Jeroen van Rijn
2026-08-13 13:14:14 +02:00
committed by GitHub

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;
}