Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

test(mem): unpoison mimalloc output before the handler reads it

Martin Vogelebdf9bafd5d3
diff --git a/tests/test_main.c b/tests/test_main.c
index b8410d48c..71057b84c 100644
--- a/tests/test_main.c
+++ b/tests/test_main.c
@@ -2148,10 +2148,14 @@ static void tf_msan_mi_output(const char *msg, void *arg) {
/* Registering replays mimalloc's delayed-output buffer into the handler.
* Its constructor already wrote all of that to stderr before main, so the
* replay would only repeat it behind a stray newline: skip it. */
- if (!tf_msan_mi_output_live || !msg || !msg[0]) {
+ if (!tf_msan_mi_output_live || !msg) {
return;
}
+ /* Mark the text initialized before reading even its first byte. */
__msan_unpoison_string(msg);
+ if (!msg[0]) {
+ return;
+ }
(void)fputs(msg, stderr);
}
#endif