authorgravatar for flandere@synkhronix.comFlandreScarlet <flandere@synkhronix.com> 2022-06-23 14:07:08+02:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-06-23 15:07:08+03:00
log87d8cb19e4eed905b93d39554ea9a2a1012f6668
tree31a205c59129b7308b20d0ad62a8b77cdb799d92
parent6de0c622ff770628110208f5edeff54940cf5caa
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

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 files changed, 1 insertions(+), 1 deletions(-)

lib/std/debug.zig+1-1
...@@ -1999,7 +1999,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize...@@ -1999,7 +1999,7 @@ pub fn ConfigurableTrace(comptime size: usize, comptime stack_frame_count: usize
19991999
2000 const tty_config = detectTTYConfig();2000 const tty_config = detectTTYConfig();
2001 const stderr = io.getStdErr().writer();2001 const stderr = io.getStdErr().writer();
2002 const end = @maximum(t.index, size);2002 const end = @minimum(t.index, size);
2003 const debug_info = getSelfDebugInfo() catch |err| {2003 const debug_info = getSelfDebugInfo() catch |err| {
2004 stderr.print(2004 stderr.print(
2005 "Unable to dump stack trace: Unable to open debug info: {s}\n",2005 "Unable to dump stack trace: Unable to open debug info: {s}\n",