aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2010-03-30 19:29:02 +0300
committerEli Zaretskii2010-03-30 19:29:02 +0300
commitbd924a5d6cea9a17c4c46f6ce3ecdef875dad69f (patch)
treead3fbea62fabcb6e94c48984656918dad7433f7d /src
parent2223a1b3346c38d4b76c136f35c55ed161cb7e24 (diff)
downloademacs-bd924a5d6cea9a17c4c46f6ce3ecdef875dad69f.tar.gz
emacs-bd924a5d6cea9a17c4c46f6ce3ecdef875dad69f.zip
Fix a crash of I-search in a bidi-reordered buffer.
bidi.c (bidi_cache_iterator_state): Invalidate the cache if we are outside the range of cached character positions.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/bidi.c14
2 files changed, 15 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 7809565de87..44c55252b62 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12010-03-30 Eli Zaretskii <eliz@gnu.org>
2
3 * bidi.c (bidi_cache_iterator_state): Invalidate the cache if we
4 are outside the range of cached character positions.
5
12010-03-30 Juanma Barranquero <lekktu@gmail.com> 62010-03-30 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * makefile.w32-in ($(BLD)/bidi.$(O)): Add dependency on w32gui.h. 8 * makefile.w32-in ($(BLD)/bidi.$(O)): Add dependency on w32gui.h.
diff --git a/src/bidi.c b/src/bidi.c
index d5e28cd2d8a..ea47cd33fec 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -671,10 +671,16 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
671 /* Don't overrun the cache limit. */ 671 /* Don't overrun the cache limit. */
672 if (idx > sizeof (bidi_cache) / sizeof (bidi_cache[0]) - 1) 672 if (idx > sizeof (bidi_cache) / sizeof (bidi_cache[0]) - 1)
673 abort (); 673 abort ();
674 /* Don't violate cache integrity: character positions should 674 /* Character positions should correspond to cache positions 1:1.
675 correspond to cache positions 1:1. */ 675 If we are outside the range of cached positions, the cache is
676 if (idx > 0 && bidi_it->charpos != bidi_cache[idx - 1].charpos + 1) 676 useless and must be reset. */
677 abort (); 677 if (idx > 0 &&
678 (bidi_it->charpos > bidi_cache[idx - 1].charpos + 1
679 || bidi_it->charpos < bidi_cache[0].charpos))
680 {
681 bidi_cache_reset ();
682 idx = 0;
683 }
678 bidi_copy_it (&bidi_cache[idx], bidi_it); 684 bidi_copy_it (&bidi_cache[idx], bidi_it);
679 if (!resolved) 685 if (!resolved)
680 bidi_cache[idx].resolved_level = -1; 686 bidi_cache[idx].resolved_level = -1;