Subject: bug#46709: 28.0.50; Emacs crash in gnutls_handshake

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 24 Feb 2021 17:55:58 +0100

Robert Pluim <[email-masked]> writes:

> My reading of
> <https://gnutls.org/manual/gnutls.html#gnutls_005fhandshake> is that
> after receiving a fatal error, we should not call gnutls_handshake
> again. Iʼve tested the following patch successfully. We currently
> check only for GNUTLS_E_INTERRUPTED, but the list of non-fatal error
> codes is more than that, so perhaps more is needed.
>
> diff --git a/src/gnutls.c b/src/gnutls.c
> index aa245ee5c3..4d5a909db0 100644
> --- a/src/gnutls.c
> +++ b/src/gnutls.c
> @@ -625,6 +625,8 @@ gnutls_try_handshake (struct Lisp_Process *proc)
>
>    while ((ret = gnutls_handshake (state)) < 0)
>      {
> +      if (gnutls_error_is_fatal (ret))
> +	return emacs_gnutls_handle_error (state, ret);

Yes, I think that this looks like the correct fix here.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no