aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorblob1807 <12388588+blob1807@users.noreply.github.com>2025-12-23 19:17:43 +1000
committerblob1807 <12388588+blob1807@users.noreply.github.com>2025-12-23 19:17:43 +1000
commit4eeb509fe8f1750be784786d4ac6470d6591fd6e (patch)
treee8a5508d8ec3952e47276679db5e31953b532e55
parent56194732a8b73412970cc4a6dd41c7792db77832 (diff)
Fix an OOB & format exception code as hex
Fix an OOB caused when the test runner catches the exception & format exception codes as upper case hex.
-rw-r--r--core/testing/signal_handler_windows.odin20
1 files changed, 7 insertions, 13 deletions
diff --git a/core/testing/signal_handler_windows.odin b/core/testing/signal_handler_windows.odin
index 2942b5bd2..8843dde92 100644
--- a/core/testing/signal_handler_windows.odin
+++ b/core/testing/signal_handler_windows.odin
@@ -17,6 +17,7 @@ import "base:intrinsics"
import "core:os"
import "core:sync"
import "core:c/libc"
+import "core:strconv"
import "core:terminal/ansi"
import win32 "core:sys/windows"
@@ -89,23 +90,16 @@ stop_test_callback :: proc "system" (info: ^win32.EXCEPTION_POINTERS) -> win32.L
os.flush(os.stdout)
}
- // This is an attempt at being compliant by avoiding printf.
expbuf: [8]byte
- expstr: string
- {
- expnum := cast(int)code
- i := len(expbuf) - 2
- for expnum > 0 {
- m := expnum % 10
- expnum /= 10
- expbuf[i] = cast(u8)('0' + m)
- i -= 1
+ expstr := strconv.write_uint(expbuf[:], cast(u64)code, 16)
+ for &c in expbuf {
+ if 'a' <= c && c <= 'f' {
+ c -= 32
}
- expstr = cast(string)expbuf[1 + i:len(expbuf) - 1]
}
advisory_a := `
-The test runner's main thread has caught an unrecoverable error (signal `
+The test runner's main thread has caught an unrecoverable error (exception 0x`
advisory_b := `) and will now forcibly terminate.
This is a dire bug and should be reported to the Odin developers.
`
@@ -155,7 +149,7 @@ This is a dire bug and should be reported to the Odin developers.
}
// Pass on the exeption to the next handler. As we don't wont to recover from it.
- // This will allow debuggers handle it properly.
+ // This also allows debuggers handle it properly.
return win32.EXCEPTION_CONTINUE_SEARCH
}