authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-19 08:20:15-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-09-26 19:08:50-04:00
log4e4e8902e5bec12befd191b6ce412d60ced819f4
treee1f880c526db3cd0c954bb84578e2f44a2eeacec
parente4c1598ac8dd984a480fad41e61cc60c41448cac

Build: fix UAF of step names


4 files changed, 4 insertions(+), 4 deletions(-)

lib/std/Build/Step.zig+1-1
......@@ -95,7 +95,7 @@ pub fn init(options: StepOptions) Step {
9595
9696 return .{
9797 .tag = options.tag,
98 .name = arena.dupe(u8, options.name) catch @panic("OOM"),
98 .name = options.owner.graph.dupeString(options.name),
9999 .owner = options.owner,
100100 .dependencies = .empty,
101101 .max_rss = options.max_rss,
lib/std/Build/Step/CheckFile.zig+1-1
......@@ -41,5 +41,5 @@ pub fn create(owner: *std.Build, file: std.Build.LazyPath, options: Options) *Ch
4141}
4242
4343pub fn setName(check_file: *CheckFile, name: []const u8) void {
44 check_file.step.name = name;
44 check_file.step.name = check_file.step.owner.graph.dupeString(name);
4545}
lib/std/Build/Step/Run.zig+1-1
......@@ -241,7 +241,7 @@ pub fn create(owner: *std.Build, name: []const u8) *Run {
241241}
242242
243243pub fn setName(run: *Run, name: []const u8) void {
244 run.step.name = name;
244 run.step.name = run.step.owner.graph.dupeString(name);
245245 run.rename_step_with_output_arg = false;
246246}
247247
test/tests.zig+1-1
......@@ -2502,7 +2502,7 @@ pub fn addStandaloneTests(
25022502 .simple_skip_release_small = mem.findScalar(OptimizeMode, optimize_modes, .small) == null,
25032503 });
25042504 const test_cases_dep_step = test_cases_dep.builder.default_step;
2505 test_cases_dep_step.name = b.graph.dupeString(test_cases_dep_name);
2505 test_cases_dep_step.name = test_cases_dep_name;
25062506 step.dependOn(test_cases_dep.builder.default_step);
25072507 return step;
25082508}