Skip to content

Commit fc0b117

Browse files
committed
fix memory corruption bug
internPathWithName when prefix is not empty is a delicate operation and the code in question was misusing the api, causing garbage to occasionally end up in the path table
1 parent 0e7d06e commit fc0b117

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/root.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,9 +1225,9 @@ pub fn run(gpa: Allocator, cfg: *const Config, options: Options) Build {
12251225
const prefix = p._scan.url.slice(&v.path_table);
12261226
try v.path_table.path_components.ensureUnusedCapacity(
12271227
gpa,
1228-
prefix.len + std.mem.count(u8, alt.output, "/"),
1228+
prefix.len + std.mem.count(u8, alt.output, "/") + 1,
12291229
);
1230-
break :blk prefix;
1230+
break :blk p._scan.url.slice(&v.path_table);
12311231
};
12321232
const url = try v.path_table.internPathWithName(
12331233
gpa,

0 commit comments

Comments
 (0)