Commit 62a8cfd5fe

Alex Rønne Petersen <alex@alexrp.com>
2025-10-14 23:07:22
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.
1 parent a36dab2
Changed files (1)
lib
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,