From f51ccf0d1f015c0f3bf8c9bebce65665e557c7de Mon Sep 17 00:00:00 2001 From: Travis Date: Wed, 21 Oct 2020 18:59:33 -0500 Subject: [PATCH] panic when empty string passed as dest_rel_path to addInstallFileWithDir causes the creation of a file instead of the directory that's meant to be created --- lib/std/build.zig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/std/build.zig b/lib/std/build.zig index ef0ead9def..a1ac3f88f2 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -907,6 +907,9 @@ pub const Builder = struct { install_dir: InstallDir, dest_rel_path: []const u8, ) *InstallFileStep { + if (dest_rel_path.len == 0) { + panic("dest_rel_path must be non-empty", .{}); + } const install_step = self.allocator.create(InstallFileStep) catch unreachable; install_step.* = InstallFileStep.init(self, src_path, install_dir, dest_rel_path); return install_step;