Skip to content

Commit 87d8cb1

Browse files
std.debug: fix ConfigurableTrace.dump OOB
The for-loop in dump() would index out of bounds if `t.index` is greater than size, because `end` is the maximum of `t.index` and `size` rather than the minimum.
1 parent 6de0c62 commit 87d8cb1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/std/debug.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1999,7 +1999,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize
19991999

20002000
const tty_config = detectTTYConfig();
20012001
const stderr = io.getStdErr().writer();
2002-
const end = @maximum(t.index, size);
2002+
const end = @minimum(t.index, size);
20032003
const debug_info = getSelfDebugInfo() catch |err| {
20042004
stderr.print(
20052005
"Unable to dump stack trace: Unable to open debug info: {s}\n",

0 commit comments

Comments
 (0)