Skip to content

Commit ccced2e

Browse files
authored
Initialize variable in mono_utility_thread_send_sync (#121490)
By design `done` variable should be set to false and changed to true, when thread finished. But for now, `done` is not initialized. `done` is used in the loop to check finish status and then as the return value. An uninitialized variable contains a random value. In most cases, this is interpreted as true and leads to early function termination and an incorrect return value. Signed-off-by: Aleksandr Dovydenkov <asd@altlinux.org>. Found by Linux Verification Center (linuxtesting.org) with SVACE.
1 parent fec33be commit ccced2e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/mono/mono/utils/mono-utility-thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mono_utility_thread_send_sync (MonoUtilityThread *thread, gpointer message)
152152
mono_os_sem_init (&sem, 0);
153153

154154
UtilityThreadQueueEntry *entry = (UtilityThreadQueueEntry*)mono_lock_free_alloc (&thread->message_allocator);
155-
gboolean done;
155+
gboolean done = FALSE;
156156

157157
entry->finished = &done;
158158
entry->response_sem = &sem;

0 commit comments

Comments
 (0)