Subject: Re: bug#77065: 31.0.50; Infinite loop in move_it_to

From: Eli Zaretskii <[email-masked]>
Date: Mon, 17 Mar 2025 16:27:43 +0200

> Date: Mon, 17 Mar 2025 00:03:34 -0700
> From: Yifan Zhu <[email-masked]>
> 
> # Steps to reproduce
> 
> - install xenops (https://github.com/dandavison/xenops)
> - open latex file given below

Thanks, but I don't have access to a system where these prerequisites
can be met.  So either someone can reproduce this, debug the problem,
and describe the reason for the loop, or I'd need to ask you to do it,
if possible.  Or, if you can show a recipe for reproducing the problem
without installing LaTeX and xenops, I could try reproducing this on
the systems to which I have access.

> - Put cursor on the line starting with "since"
> - use ctrl+scroll to enlarge view
> - M-x split-window-right
> - observe that emacs freezes, uses 100% of CPU, and eventually OOMs; gdb 
> shows it is stuck in infinite loop in move_it_to

Can you describe how you arrived at the conclusion that it infloops in
that function?  Can you step in GDB through one iteration of that
loop and show the values of variables which cause Emacs never to exit
the loop?

> #1  0x0000555555622e6c in move_it_to (it=0x7fffffff6df0, to_charpos=218, 
> to_x=-1, to_y=-1, to_vpos=-1, op=8) at xdisp.c:10945

The downstream bug report shows a very different (much larger) buffer
position as the value of to_charpos (34559).  Is that expected? is
that significant?