mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 21:08:36 +00:00
stage2: fix UAF of system_libs
This commit is contained in:
parent
55243cfb31
commit
9dc25dd0b6
@ -1985,7 +1985,7 @@ pub fn update(comp: *Compilation) !void {
|
||||
|
||||
// This resets the link.File to operate as if we called openPath() in create()
|
||||
// instead of simulating -fno-emit-bin.
|
||||
var options = comp.bin_file.options;
|
||||
var options = comp.bin_file.options.move();
|
||||
if (comp.whole_bin_sub_path) |sub_path| {
|
||||
options.emit = .{
|
||||
.directory = tmp_artifact_directory.?,
|
||||
|
||||
@ -167,6 +167,12 @@ pub const Options = struct {
|
||||
pub fn effectiveOutputMode(options: Options) std.builtin.OutputMode {
|
||||
return if (options.use_lld) .Obj else options.output_mode;
|
||||
}
|
||||
|
||||
pub fn move(self: *Options) Options {
|
||||
const copied_state = self.*;
|
||||
self.system_libs = .{};
|
||||
return copied_state;
|
||||
}
|
||||
};
|
||||
|
||||
pub const File = struct {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user