1 From fbad64abe28a96f591a30e3a5d3189c10172a414 Mon Sep 17 00:00:00 2001
2 From: Adam Williamson <awilliam@redhat.com>
3 Date: Tue, 30 Aug 2022 10:03:57 -0700
4 Subject: [PATCH 1/2] rest_proxy_call_sync: bail out if no payload
6 goa-daemon is crashing on suspend/resume with a traceback that
7 points here: it calls rest_proxy_call_sync, that calls
8 _rest_proxy_send_message, assumes it gets a `payload` back,
9 and calls `finish_call` with it. However, it's not actually
10 guaranteed that `_rest_proxy_send_message` will return a payload
11 (a `GBytes`). There are three ways it can return `NULL` instead:
12 if it's passed a wrong proxy or message, or - when built against
13 libsoup3 - if there is an error sending the message (it passes
14 through the return value of `soup_session_send_and_read`, and
15 that's documented to be `NULL` on error).
17 If `payload` comes back `NULL`, let's just return `FALSE`, like
18 we do if there's a problem with the call or message.
20 Signed-off-by: Adam Williamson <awilliam@redhat.com>
22 rest/rest-proxy-call.c | 2 ++
23 1 file changed, 2 insertions(+)
25 diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c
26 index 851b397..07b8b49 100644
27 --- a/rest/rest-proxy-call.c
28 +++ b/rest/rest-proxy-call.c
29 @@ -1428,6 +1428,8 @@ rest_proxy_call_sync (RestProxyCall *call,
32 payload = _rest_proxy_send_message (priv->proxy, message, priv->cancellable, error_out);
36 ret = finish_call (call, message, payload, error_out);
42 From 8049048a0f7d52b3f4101c7123797fed099d4cc8 Mon Sep 17 00:00:00 2001
43 From: Adam Williamson <awilliam@redhat.com>
44 Date: Tue, 30 Aug 2022 10:59:01 -0700
45 Subject: [PATCH 2/2] Handle some potential problems in parsing oauth2 access
48 It's possible for `_rest_proxy_send_message` to return `NULL`,
49 which would mean the `payload` here would be `NULL`. If so,
50 we're not going to be able to do anything, so we should just
53 Signed-off-by: Adam Williamson <awilliam@redhat.com>
55 rest/rest-oauth2-proxy.c | 2 ++
56 1 file changed, 2 insertions(+)
58 diff --git a/rest/rest-oauth2-proxy.c b/rest/rest-oauth2-proxy.c
59 index 9511f97..7d5780d 100644
60 --- a/rest/rest-oauth2-proxy.c
61 +++ b/rest/rest-oauth2-proxy.c
62 @@ -70,6 +70,8 @@ rest_oauth2_proxy_parse_access_token (RestOAuth2Proxy *self,
65 g_return_if_fail (REST_IS_OAUTH2_PROXY (self));
69 data = g_bytes_get_data (payload, &size);