emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r99778: Fix a crash of I-search in a


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99778: Fix a crash of I-search in a bidi-reordered buffer.
Date: Tue, 30 Mar 2010 19:29:02 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99778
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Tue 2010-03-30 19:29:02 +0300
message:
  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.
modified:
  src/ChangeLog
  src/bidi.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-03-30 12:15:45 +0000
+++ b/src/ChangeLog     2010-03-30 16:29:02 +0000
@@ -1,3 +1,8 @@
+2010-03-30  Eli Zaretskii  <address@hidden>
+
+       * bidi.c (bidi_cache_iterator_state): Invalidate the cache if we
+       are outside the range of cached character positions.
+
 2010-03-30  Juanma Barranquero  <address@hidden>
 
        * makefile.w32-in ($(BLD)/bidi.$(O)): Add dependency on w32gui.h.

=== modified file 'src/bidi.c'
--- a/src/bidi.c        2010-03-30 10:02:24 +0000
+++ b/src/bidi.c        2010-03-30 16:29:02 +0000
@@ -671,10 +671,16 @@
       /* Don't overrun the cache limit.  */
       if (idx > sizeof (bidi_cache) / sizeof (bidi_cache[0]) - 1)
        abort ();
-      /* Don't violate cache integrity: character positions should
-        correspond to cache positions 1:1.  */
-      if (idx > 0 && bidi_it->charpos != bidi_cache[idx - 1].charpos + 1)
-       abort ();
+      /* Character positions should correspond to cache positions 1:1.
+        If we are outside the range of cached positions, the cache is
+        useless and must be reset.  */
+      if (idx > 0 &&
+         (bidi_it->charpos > bidi_cache[idx - 1].charpos + 1
+          || bidi_it->charpos < bidi_cache[0].charpos))
+       {
+         bidi_cache_reset ();
+         idx = 0;
+       }
       bidi_copy_it (&bidi_cache[idx], bidi_it);
       if (!resolved)
        bidi_cache[idx].resolved_level = -1;


reply via email to

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