From: Bart Van Assche Date: Fri, 22 Mar 2019 03:08:45 +0000 (-0700) Subject: drd: Fix an integer overflow in the stack margin calculation X-Git-Tag: VALGRIND_3_15_0~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=30b3264e60aea7c0b5d6578f6bb87087fd99ff05;p=thirdparty%2Fvalgrind.git drd: Fix an integer overflow in the stack margin calculation --- diff --git a/NEWS b/NEWS index c9431a2a39..a460d8eae5 100644 --- a/NEWS +++ b/NEWS @@ -112,6 +112,7 @@ where XXXXXX is the bug number as listed below. 405079 unhandled ppc64le-linux syscall: 131 (quotactl) 405403 s390x disassembler cannot be used on x86 405458 MIPS mkFormVEC arguments swapped? +405716 drd: Fix an integer overflow in the stack margin calculation n-i-bz add syswrap for PTRACE_GET|SET_THREAD_AREA on amd64. n-i-bz Fix callgrind_annotate non deterministic order for equal total diff --git a/drd/drd_main.c b/drd/drd_main.c index 3df967ef28..6d6ca637dc 100644 --- a/drd/drd_main.c +++ b/drd/drd_main.c @@ -705,12 +705,11 @@ static void drd_thread_finished(ThreadId vg_tid) = (DRD_(thread_get_stack_max)(drd_tid) - DRD_(thread_get_stack_min_min)(drd_tid)); VG_(message)(Vg_UserMsg, - "thread %u%s finished and used %lu bytes out of %lu" - " on its stack. Margin: %lu bytes.\n", + "thread %u%s finished and used %lu bytes out of %lu on its stack. Margin: %ld bytes.\n", drd_tid, DRD_(thread_get_joinable)(drd_tid) ? "" : " (which is a detached thread)", - used_stack, stack_size, stack_size - used_stack); + used_stack, stack_size, (long)(stack_size - used_stack)); } drd_stop_using_mem(DRD_(thread_get_stack_min)(drd_tid),