drd: Fix an integer overflow in the stack margin calculation

This commit is contained in:
Bart Van Assche 2019-03-21 20:08:45 -07:00
parent 2cfe32ab11
commit 30b3264e60
2 changed files with 3 additions and 3 deletions

1
NEWS
View File

@ -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

View File

@ -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),