From c2d2963d2c69d3a52e491e149fbaeeb5813b9e24 Mon Sep 17 00:00:00 2001 From: Pascal Obry Date: Wed, 23 May 2018 10:23:59 +0000 Subject: [PATCH] [Ada] Fix computation of handle/pid lists in win32_wait An obvious mistake due to missing parentheses was not properly computing the size of the handle and pid list passed to WaitForMultipleObjects(). This resulted in a memory corruption. 2018-05-23 Pascal Obry gcc/ada/ * adaint.c (win32_wait): Add missing parentheses. From-SVN: r260598 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/adaint.c | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e1f83b5e013..c2df68d1562 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2018-05-23 Pascal Obry + + * adaint.c (win32_wait): Add missing parentheses. + 2018-05-23 Hristian Kirtchev * exp_ch3.adb (Check_Large_Modular_Array): Moved to Freeze. diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 9e0919e5dfa..07e55e4eb85 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -2591,10 +2591,10 @@ win32_wait (int *status) #else /* Note that index 0 contains the event handle that is signaled when the process list has changed */ - hl = (HANDLE *) xmalloc (sizeof (HANDLE) * hl_len + 1); + hl = (HANDLE *) xmalloc (sizeof (HANDLE) * (hl_len + 1)); hl[0] = ProcListEvt; memmove (&hl[1], HANDLES_LIST, sizeof (HANDLE) * hl_len); - pidl = (int *) xmalloc (sizeof (int) * hl_len + 1); + pidl = (int *) xmalloc (sizeof (int) * (hl_len + 1)); memmove (&pidl[1], PID_LIST, sizeof (int) * hl_len); hl_len++; #endif -- 2.30.2