authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2023-05-27 15:07:44-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-05-30 01:21:01-07:00
log9244e4fe2d675c6cda569afc7509349e35199ed5
tree638fc119d65fb9ea1337256429fdd613094cc6bc
parent22b0457dd4b73d3cce2e52b77b3b7c9f857c0409

cache: handle 0-length prefix paths in findPrefixResolved


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

lib/std/Build/Cache.zig+1-1
......@@ -123,7 +123,7 @@ fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath {
123123 var i: u8 = 1; // Start at 1 to skip over checking the null prefix.
124124 while (i < prefixes_slice.len) : (i += 1) {
125125 const p = prefixes_slice[i].path.?;
126 if (mem.startsWith(u8, resolved_path, p)) {
126 if (p.len > 0 and mem.startsWith(u8, resolved_path, p)) {
127127 // +1 to skip over the path separator here
128128 const sub_path = try gpa.dupe(u8, resolved_path[p.len + 1 ..]);
129129 gpa.free(resolved_path);