emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r106481: * xdisp.c (compute_stop_pos)


From: Chong Yidong
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r106481: * xdisp.c (compute_stop_pos): Check validity of end_charpos before using it.
Date: Wed, 23 Nov 2011 14:47:09 +0800
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 106481
fixes bug(s): http://debbugs.gnu.org/5984
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Wed 2011-11-23 14:47:09 +0800
message:
  * xdisp.c (compute_stop_pos): Check validity of end_charpos before using it.
modified:
  src/ChangeLog
  src/xdisp.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-11-22 18:00:38 +0000
+++ b/src/ChangeLog     2011-11-23 06:47:09 +0000
@@ -1,3 +1,8 @@
+2011-11-23  Chong Yidong  <address@hidden>
+
+       * xdisp.c (compute_stop_pos): Check validity of end_charpos before
+       using it (Bug#5984).
+
 2011-11-22  Eli Zaretskii  <address@hidden>
 
        * dispnew.c (adjust_glyph_matrix): Don't verify hash code of mode-

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2011-11-20 02:29:42 +0000
+++ b/src/xdisp.c       2011-11-23 06:47:09 +0000
@@ -3166,13 +3166,11 @@
   Lisp_Object object, limit, position;
   EMACS_INT charpos, bytepos;
 
-  /* If nowhere else, stop at the end.  */
-  it->stop_charpos = it->end_charpos;
-
   if (STRINGP (it->string))
     {
       /* Strings are usually short, so don't limit the search for
         properties.  */
+      it->stop_charpos = it->end_charpos;
       object = it->string;
       limit = Qnil;
       charpos = IT_STRING_CHARPOS (*it);
@@ -3182,6 +3180,12 @@
     {
       EMACS_INT pos;
 
+      /* If end_charpos is out of range for some reason, such as a
+        misbehaving display function, rationalize it (Bug#5984).  */
+      if (it->end_charpos > ZV)
+       it->end_charpos = ZV;
+      it->stop_charpos = it->end_charpos;
+
       /* If next overlay change is in front of the current stop pos
         (which is IT->end_charpos), stop there.  Note: value of
         next_overlay_change is point-max if no overlay change


reply via email to

[Prev in Thread] Current Thread [Next in Thread]