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

From: Daniel Clemente <[email-masked]>
Date: Sun, 8 Sep 2024 11:09:40 +0000

> I attach the patch now, sorry for not doing it earlier.
>

Please attach patches if I can help trying out things. I don't know
this code so I may break it if I change the low-level behavior. But I
can safely add many breakpoints and debug messages to research the
bugs.
Apparently we could use more assertions in other parts of the code, or
move the existing ones (under glyph debug) to catch the problem
earlier.

In cmcheckmagic we have:
      if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1)
          emacs_abort ();

Is this an assertion that needs to always hold? 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.