zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 62a8cfd5fed1380331b10d20fbb7b08f206cf541 (tree)
parent a36dab2f90020c5544fddf68520c2057edc2ec00
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Tue, 14 Oct 2025 23:07:22 +0200

std.debug: fix an invalid read in StackIterator.next()

We're overwriting the memory that unwind_context sits in, so we need to do the
getFp() call earlier.

Diffstat:
Mlib/std/debug.zig | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/std/debug.zig b/lib/std/debug.zig @@ -925,7 +925,8 @@ const StackIterator = union(enum) { const di_gpa = getDebugInfoAllocator(); const ret_addr = di.unwindFrame(di_gpa, unwind_context) catch |err| { const pc = unwind_context.pc; - it.* = .{ .fp = unwind_context.getFp() }; + const fp = unwind_context.getFp(); + it.* = .{ .fp = fp }; return .{ .switch_to_fp = .{ .address = pc, .err = err,