mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
test(mem): unpoison mimalloc output before the handler reads it
The MSan output handler checked msg[0] before marking the text initialized, so MSan reported the handler's own read (tests/test_main.c:2151). Unpoison first, then test for the empty replay. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
This commit is contained in:
1 parent
0f8b46570c
commit
ebdf9bafd5
1 file changed
+5
-1
+5
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user