From: Bart Van Assche Date: Fri, 2 May 2008 17:27:08 +0000 (+0000) Subject: Added an assert statement to check the validity of the computed highest used stack... X-Git-Tag: svn/VALGRIND_3_4_0~647 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=675142af40ad7bfacee81e8f6d66cb840548eedc;p=thirdparty%2Fvalgrind.git Added an assert statement to check the validity of the computed highest used stack address. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7990 --- diff --git a/exp-drd/drd_clientreq.c b/exp-drd/drd_clientreq.c index 74803bdab9..7a7c5ec3bc 100644 --- a/exp-drd/drd_clientreq.c +++ b/exp-drd/drd_clientreq.c @@ -92,10 +92,15 @@ static Addr highest_used_stack_address(const ThreadId vg_tid) UInt nframes; const UInt n_ips = 10; Addr ips[n_ips], sps[n_ips]; + Addr husa; nframes = VG_(get_StackTrace)(vg_tid, ips, n_ips, sps, 0, 0); - return (nframes >= 1 ? sps[nframes - 1] : VG_(get_SP)(vg_tid)); + husa = (nframes >= 1 ? sps[nframes - 1] : VG_(get_SP)(vg_tid)); + tl_assert(VG_(thread_get_stack_max)(vg_tid) + - VG_(thread_get_stack_size)(vg_tid) <= husa + && husa <= VG_(thread_get_stack_max)(vg_tid)); + return husa; } static Bool drd_handle_client_request(ThreadId vg_tid, UWord* arg, UWord* ret)