bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error


From: Po Lu
Subject: bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error
Date: Mon, 04 Jul 2022 18:10:00 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

dick <dick.r.chiang@gmail.com> writes:

>>From 5d2442a836a5641f8f1c2b4a844fe510a77bd8c5 Mon Sep 17 00:00:00 2001
> From: dickmao <dick.r.chiang@gmail.com>
> Date: Mon, 4 Jul 2022 00:47:34 -0400
> Subject: [PATCH] Avoid segfault
>
> * src/xterm.c (x_connection_closed): Avoid segfault.
> ---
>  src/xterm.c | 23 ++++++++++++-----------
>  1 file changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/src/xterm.c b/src/xterm.c
> index c5acb450837..464887da975 100644
> --- a/src/xterm.c
> +++ b/src/xterm.c
> @@ -23518,17 +23518,18 @@ x_connection_closed (Display *dpy, const char 
> *error_message, bool ioerror)
>  
>         fprintf (stderr, "X error handlers currently installed:\n");
>  
> -       for (failable = dpyinfo->failable_requests;
> -            failable < dpyinfo->next_failable_request;
> -            ++failable)
> -         {
> -           if (failable->end)
> -             fprintf (stderr, "Ignoring errors between %lu to %lu\n",
> -                      failable->start, failable->end);
> -           else
> -             fprintf (stderr, "Ignoring errors from %lu onwards\n",
> -                      failable->start);
> -         }
> +       if (dpyinfo)
> +         for (failable = dpyinfo->failable_requests;
> +              failable < dpyinfo->next_failable_request;
> +              ++failable)
> +           {
> +             if (failable->end)
> +               fprintf (stderr, "Ignoring errors between %lu to %lu\n",
> +                        failable->start, failable->end);
> +             else
> +               fprintf (stderr, "Ignoring errors from %lu onwards\n",
> +                        failable->start);
> +           }
>  
>         for (stack = x_error_message; stack; stack = stack->prev)
>           fprintf (stderr, "Trapping errors from %lu\n",

That piece of code is already inside "if (dpyinfo)" -- in fact, your
patch misses a use-after-free, which has already been fixed on master.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]