Commit 6b21de18 authored by Chong Yidong's avatar Chong Yidong

* xdisp.c (compute_stop_pos): Check validity of end_charpos before using it.

Fixes: debbugs:5984
parent e37df674
2011-11-23 Chong Yidong <cyd@gnu.org>
* xdisp.c (compute_stop_pos): Check validity of end_charpos before
using it (Bug#5984).
2011-11-22 Eli Zaretskii <eliz@gnu.org>
* dispnew.c (adjust_glyph_matrix): Don't verify hash code of mode-
......
......@@ -3166,13 +3166,11 @@ compute_stop_pos (struct it *it)
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 @@ compute_stop_pos (struct it *it)
{
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment