Subject: Re: bug#77233: 31.0.50; crash if message starts with a space and then without it

From: Eli Zaretskii <[email-masked]>
Date: Mon, 24 Mar 2025 20:20:34 +0200

> Date: Mon, 24 Mar 2025 14:14:11 +0000
> From: Pip Cet <[email-masked]>
> Cc: Daniel Clemente <[email-masked]>, [email-masked]
> 
> "Eli Zaretskii" <[email-masked]> writes:
> 
> >> #2  0x00005555556730a9 in cmcheckmagic (tty=0x555555a983a0) at cm.c:122
> >> 122        emacs_abort ();
> >> (gdb) list
> >> 117      if (frame_size_change_delayed (XFRAME (tty->top_frame)))
> >> 118        return;
> >> 119      if (curX (tty) == FrameCols (tty))
> >> 120        {
> >> 121          if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1)
> >> 122        emacs_abort ();
> >> 123          if (tty->termscript)
> >> 124        putc ('\r', tty->termscript);
> >> 125          putc ('\r', tty->output);
> >> 126          if (tty->termscript)
> >> (gdb) p curY(tty)
> >> $1 = 60
> >> (gdb) p FrameRows(tty)-1
> >> $2 = 60
> >> (gdb) p FrameCols(tty)
> >> $3 = 100
> >> (gdb)
> >
> > What is the value of curX(tty) ?  And if (as I'd expect) it is 100,
> > then do you have any idea how come it became 100 for a 2-character
> > message?
> 
> It is equal to FrameCols (tty), as established in line 119 (this
> requires a breakpoint in emacs_abort rather than terminate_due_to_signal).
> 
> > Can anyone else reproduce this?
> 
> I can, on GNU/Linux with no special options and in an xterm.

And you can explain how come curX(tty) got such a large value?

> Reverting 6fb68f4310d808827b83da053fbc112b316b7757 avoids the crash.

Adding Gerd.