aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Schwab2009-09-11 16:46:08 +0000
committerAndreas Schwab2009-09-11 16:46:08 +0000
commit78012bd2ec6d3d152c420d3a0b091956b9814780 (patch)
tree77f1f2e93027d3de2e401b8277ee65198d7fd414
parent7e0aa125bcf84c423a261a84970a0402764c353a (diff)
downloademacs-78012bd2ec6d3d152c420d3a0b091956b9814780.tar.gz
emacs-78012bd2ec6d3d152c420d3a0b091956b9814780.zip
(display_mode_element): Detect cycles.
-rw-r--r--src/ChangeLog4
-rw-r--r--src/xdisp.c16
2 files changed, 13 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index de2c7c30f44..d06faa3d711 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12009-09-11 Andreas Schwab <schwab@linux-m68k.org>
2
3 * xdisp.c (display_mode_element): Detect cycles.
4
12009-09-11 Stefan Monnier <monnier@iro.umontreal.ca> 52009-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
2 6
3 * keymap.c (where_is_internal): Don't erroneously return nil right after 7 * keymap.c (where_is_internal): Don't erroneously return nil right after
diff --git a/src/xdisp.c b/src/xdisp.c
index 9108ab6bf72..58a077fe5f5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -17750,14 +17750,10 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
17750 } 17750 }
17751 else if (STRINGP (car) || CONSP (car)) 17751 else if (STRINGP (car) || CONSP (car))
17752 { 17752 {
17753 register int limit = 5000; 17753 Lisp_Object halftail = elt;
17754 /* Limit is to protect against circular lists. 17754 int len = 0;
17755 The limit used to be 50, but if you use enough minor modes, 17755
17756 minor-mode-alist will easily grow past 50. Circular lists
17757 are rather unlikely, so it's better for the limit to be
17758 "too large" rather than "too small". */
17759 while (CONSP (elt) 17756 while (CONSP (elt)
17760 && --limit > 0
17761 && (precision <= 0 || n < precision)) 17757 && (precision <= 0 || n < precision))
17762 { 17758 {
17763 n += display_mode_element (it, depth, 17759 n += display_mode_element (it, depth,
@@ -17769,6 +17765,12 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky)
17769 precision - n, XCAR (elt), 17765 precision - n, XCAR (elt),
17770 props, risky); 17766 props, risky);
17771 elt = XCDR (elt); 17767 elt = XCDR (elt);
17768 len++;
17769 if ((len & 1) == 0)
17770 halftail = XCDR (halftail);
17771 /* Check for cycle. */
17772 if (EQ (halftail, elt))
17773 break;
17772 } 17774 }
17773 } 17775 }
17774 } 17776 }