URL:
  <https://savannah.gnu.org/bugs/?67444>

                 Summary: crash when killing a window which is the current in
multiple displays
                   Group: GNU Screen
               Submitter: micronn
               Submitted: Tue 19 Aug 2025 08:41:10 PM GMT
                Category: Crash/Freeze/Infloop
                Severity: 3 - Normal
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 5.0.1
           Fixed Release: None
         Planned Release: None
           Work Required: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Tue 19 Aug 2025 08:41:10 PM GMT By: micronn <micronn>
Hi,

When killing a window which is the current in more than one display, screen is
crashing.

It happens if hardstatus string contains %+w or similar (all window numbers
and names starting the window after the current one).

Steps to reproduce:

Use, for example, the sample hardstatus string from manpage,

:hardstatus string '%-Lw%{#AAA;#006}%50>%n%f* %t%{-}%+Lw%<'

1) start screen and configure the hardstatus string if necessary
2) create an extra window, so we have for example windows 0 and 1
3) be sure that window 1 is the current
4) in another session, attach to screen (screen -x)
5) be sure that window 1 is the current
6) kill the window (close the shell, whatever)

[screen caught a fatal signal. (core dumped)]

It crashes when screen has more than one window.

It probably crashes in more situations, but I don't have sufficient experience
with screen to provide a more detailed report.

Here is my patch to solve the crash:

--- process.c.orig      2025-08-19 18:51:56 UTC
+++ process.c
@@ -6008,7 +6008,7 @@ char *AddWindows(WinMsgBufContext *wmbc, int len, int

        cur = GetWindowByNumber(where);

-       for (win = (flags & 4) ? cur->w_next : first_window; win; win =
win->w_next) {
+       for (win = (cur && (flags & 4)) ? cur->w_next : first_window; win; win
= win->w_next) {
                int rend = -1;
                if (win == cur && ss == buf)
                        ss = s;









    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?67444>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to