diff options
author | Michael Catanzaro <mcatanzaro@redhat.com> | 2022-11-01 13:35:06 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@redhat.com> | 2022-11-01 13:40:35 -0500 |
commit | 7f85fd126b5fde61c491243f96ea4756388c0fe1 (patch) | |
tree | dee9b0352e5db1e08187ebaedf75a0da5f90a5c5 /gio/gproxyresolver.c | |
parent | 993325400d323e05e07308ba78695e03beca8771 (diff) | |
download | glib-7f85fd126b5fde61c491243f96ea4756388c0fe1.tar.gz |
gproxyresolver: lookup_finish() should better parallel lookup_async()
In g_proxy_resolver_lookup_async() we have some error validation that
detects invalid URIs and directly returns an error, bypassing the
interface's lookup_async() function. This is great, but when the
interface's lookup_finish() function gets called later, it may assert
that the source tag of the GTask matches the interface's lookup_async()
function, which will not be the case.
As suggested by Philip, we need to check for this situation in
g_proxy_resolver_lookup_finish() and avoid calling into the interface
here if we did the same in g_proxy_resolver_lookup_async(). This can be
done by checking the source tag.
I added a few new tests to check the invalid URI "asdf" used in the
issue report. The final case, using async GProxyResolver directly,
checks for this bug.
Fixes #2799
Diffstat (limited to 'gio/gproxyresolver.c')
-rw-r--r-- | gio/gproxyresolver.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gio/gproxyresolver.c b/gio/gproxyresolver.c index 7ac64df63..61f61a797 100644 --- a/gio/gproxyresolver.c +++ b/gio/gproxyresolver.c @@ -245,6 +245,9 @@ g_proxy_resolver_lookup_finish (GProxyResolver *resolver, g_return_val_if_fail (G_IS_PROXY_RESOLVER (resolver), NULL); + if (g_async_result_is_tagged (result, g_proxy_resolver_lookup_async)) + return g_task_propagate_pointer (G_TASK (result), error); + iface = G_PROXY_RESOLVER_GET_IFACE (resolver); proxy_uris = (* iface->lookup_finish) (resolver, result, error); |