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.
This commit is contained in:
Alex Rønne Petersen 2025-10-14 23:07:22 +02:00
parent a36dab2f90
commit 62a8cfd5fe
No known key found for this signature in database

View file

@ -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,