From 02adbc11e33673c6ca531d14db79b482d608d3c0 Mon Sep 17 00:00:00 2001 From: FourteenBrush <74827262+FourteenBrush@users.noreply.github.com> Date: Thu, 13 Aug 2026 12:51:42 +0200 Subject: [PATCH] Fix oob for zero arg `#load_directory` --- src/check_builtin.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/check_builtin.cpp b/src/check_builtin.cpp index 4a59a59b7..84406c423 100644 --- a/src/check_builtin.cpp +++ b/src/check_builtin.cpp @@ -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; }