QProcess: zero-fill a struct sigaction

Otherwise valgrind (rightfully) complains:

==75693== Syscall param rt_sigaction(act->sa_flags) points to uninitialised byte(s)
==75693==    at 0x597E5F3: __libc_sigaction (libc_sigaction.c:58)
==75693==    by 0x5105CE4: QtVforkSafe::change_sigpipe(void (*)(int)) (qprocess_unix.cpp:145)
==75693==    by 0x51083AA: (anonymous namespace)::QChildProcess::startProcess() const (qprocess_unix.cpp:911)
==75693==    by 0x5106442: (anonymous namespace)::QChildProcess::startProcess(void*) (qprocess_unix.cpp:330)
==75693==    by 0x5A61BB3: clone (clone.S:100)
==75693==    by 0x1FFEFFE3DF: ???
==75693==    by 0x857E86F: ???
==75693==    by 0x1FFEFFE3EF: ???
==75693==    by 0x5102C09: std::tuple_element<0ul, std::tuple<QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> > >::type const& std::get<0ul, QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> >(std::tuple<QProcessPrivate::UnixExtras*, std::default_delete<QProcessPrivate::UnixExtras> > const&) (tuple:1796)
==75693==  Address 0x1ffeffe148 is on thread 1's stack
==75693==  in frame #0, created by __libc_sigaction (libc_sigaction.c:43)
==75693==

Change-Id: Ib5a18fb76f2b7c2c1604e73ff64a251a0418c63c
Pick-to: 6.6 6.5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2023-09-04 23:29:56 +02:00
parent ce47799de6
commit 91dcc76fc1

View File

@ -141,6 +141,7 @@ DECLARE_FUNCTIONS(sigaction)
static void change_sigpipe(decltype(SIG_DFL) new_handler)
{
struct sigaction sa;
memset(&sa, 0, sizeof(sa));
sa.sa_handler = new_handler;
sigaction(SIGPIPE, &sa, nullptr);
}