From c48791a0db7ee5e69fd061c696608c121bb5b190 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Sat, 6 Dec 2025 10:50:38 +0100 Subject: [PATCH] FreeBSD client stack: add an assert to check the stringtable doesn't get overwritten There's already an assert that the stringsize calculated matches the stringsize writte. This adds a check that the pointer table area does not overwrite the stringtable (that is, that the NULL pointer after the last auxv entry pointer does not overwrite the first string [either the interpreter or argv[0]) --- coregrind/m_initimg/initimg-freebsd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/coregrind/m_initimg/initimg-freebsd.c b/coregrind/m_initimg/initimg-freebsd.c index cd127736c..40f74168c 100644 --- a/coregrind/m_initimg/initimg-freebsd.c +++ b/coregrind/m_initimg/initimg-freebsd.c @@ -841,6 +841,8 @@ static Addr setup_client_stack(const void* init_sp, vg_assert((strtab-stringbase) == stringsize); + vg_assert((HChar*)auxv < stringbase); + /* client_SP is pointing at client's argc/argv */ if (0) { -- 2.47.3