]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Added an assert statement to check the validity of the computed highest used stack...
authorBart Van Assche <bvanassche@acm.org>
Fri, 2 May 2008 17:27:08 +0000 (17:27 +0000)
committerBart Van Assche <bvanassche@acm.org>
Fri, 2 May 2008 17:27:08 +0000 (17:27 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7990

exp-drd/drd_clientreq.c

index 74803bdab99fba4ed0dd052b4f78e4e6083b82ab..7a7c5ec3bc7f20c483f487478cdb200039cc1c69 100644 (file)
@@ -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)