unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#21200: 25.0.50; xdisp.c: infinite loop when using invisibility specs
@ 2015-08-06 18:26 Pip Cet
  2015-08-06 19:36 ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Pip Cet @ 2015-08-06 18:26 UTC (permalink / raw)
  To: 21200

[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]

Hi,
with the current git tree (revision 0aec2aac), I'm running into
problems with an infinite loop in xdisp.c which I believe to be fixed
by this patch, which is reasonably obvious:

diff --git a/src/xdisp.c b/src/xdisp.c
index e45cb87..7b221d4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4221,6 +4221,8 @@ handle_invisible_prop (struct it *it)
           if (invis == 2)
             display_ellipsis_p = true;
         }
+
+              charpos = end_charpos;
         }
       while (invis != 0 && endpos < len);

in this loop:

      do
        {
          end_charpos = Fnext_single_property_change (charpos, Qinvisible,
                              it->string, limit);
          if (INTEGERP (end_charpos))
        {
          endpos = XFASTINT (end_charpos);
          charpos = end_charpos;
          prop = Fget_text_property (end_charpos, Qinvisible, it->string);
          invis = TEXT_PROP_MEANS_INVISIBLE (prop);
          if (invis == 2)
            display_ellipsis_p = true;
        }
        }
      while (invis != 0 && endpos < len);

Without the patch, we keep calling Fnext_property_change with the same
arguments and expecting a different result, which obviously never
happens. In fact it seems to me we only need one of charpos and
end_charpos as the code currently stands, anyway. However, charpos =
f(..., charpos, ...) might cause confusion.

I can provide more detail if necessary, but as I said, it's a fairly
obvious bug.

[-- Attachment #2: emacs-006.diff --]
[-- Type: text/plain, Size: 315 bytes --]

diff --git a/src/xdisp.c b/src/xdisp.c
index e45cb87..7b221d4 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -4221,6 +4221,8 @@ handle_invisible_prop (struct it *it)
 		  if (invis == 2)
 		    display_ellipsis_p = true;
 		}
+
+              charpos = end_charpos;
 	    }
 	  while (invis != 0 && endpos < len);
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-07 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-06 18:26 bug#21200: 25.0.50; xdisp.c: infinite loop when using invisibility specs Pip Cet
2015-08-06 19:36 ` Eli Zaretskii
2015-08-06 21:16   ` Pip Cet
2015-08-07 13:46     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).