aboutsummaryrefslogtreecommitdiff
path: root/lib/std/debug.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-10-14 23:07:22 +0200
committerAlex Rønne Petersen <alex@alexrp.com>2025-10-15 13:59:17 +0200
commit62a8cfd5fed1380331b10d20fbb7b08f206cf541 (patch)
treef3dd6af5e91291d0a410888d20afdb56d6dd202e /lib/std/debug.zig
parenta36dab2f90020c5544fddf68520c2057edc2ec00 (diff)
downloadzig-62a8cfd5fed1380331b10d20fbb7b08f206cf541.tar.gz
zig-62a8cfd5fed1380331b10d20fbb7b08f206cf541.zip
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 (limited to 'lib/std/debug.zig')
-rw-r--r--lib/std/debug.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/debug.zig b/lib/std/debug.zig
index 8501df175a..83322e8a6e 100644
--- 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,