Subject: bug#73022: 31.0.50; Crash in build_frame_matrix_from_leaf_window after C-x 2 and reducing terminal size

From: martin rudalics <[email-masked]>
Date: Sun, 8 Sep 2024 16:43:54 +0200

> In cmcheckmagic we have:
 >        if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1)
 >            emacs_abort ();
 >
 > Is this an assertion that needs to always hold?

I very strongly doubt so myself.  And strangely it's _always_ an
off-by-one error here just as you sketched below.

 > I have tried
 > copy-pasting it at the beginning of tty_write_glyphs and I found that
 > it fails continuously (e.g. it tests: 62 >= 63-1). Actually I used a
 > breakpoint instead of emacs_abort.
 > Are there useful places where I could trace that  the assertion holds
 > true?, earlier places than the current place.

I suppose in all those cases curX (tty) == FrameCols (tty) does not hold
so the assertion does not trigger.

martin