Philip Withnall 82c764ce2e gthreadedresolver: Fix race between source callbacks and finalize
I had thought that because `g_source_destroy()` was called for the two
sources (cancel and timeout) in the `GTask` finalize function for a
threaded resolver operation, that it would be fine to use a plain
pointer in the source callbacks to point to the `GTask`.

That turns out to not be true: because the source callbacks are executed
in the GLib worker thread, and the `GTask` can be finalized in another
thread, it’s possible for a source callback (e.g. `cancelled_cb()`) to
be scheduled in the worker thread, then for the `GTask` to be finalized,
and then the source callback to continue execution and find itself
doing a use-after-free.

Fix that by using a weak ref to the `GTask` in the source callbacks,
rather than a plain pointer.

Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>

Fixes: #3105
2023-09-11 16:02:15 +01:00
..
2022-10-13 20:53:56 -04:00
2023-08-01 15:33:21 -03:00
2022-10-13 20:53:56 -04:00
2023-08-01 15:33:21 -03:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2023-06-27 16:49:43 +00:00
2023-08-01 15:33:21 -03:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2023-05-23 10:14:28 +00:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-05-18 14:01:43 +00:00
2022-10-13 20:53:56 -04:00
2023-04-20 08:54:23 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2023-08-17 14:25:53 +01:00
2022-10-13 20:53:56 -04:00
2023-08-01 15:33:21 -03:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-06-23 10:46:45 +01:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2023-08-01 15:33:21 -03:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00
2022-10-13 20:53:56 -04:00