emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 f160106: Avoid assertion violations in Rmail due


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 f160106: Avoid assertion violations in Rmail due to newline cache
Date: Sat, 28 Feb 2015 10:34:56 +0000

branch: emacs-24
commit f1601063f29c99be77d2513320ed6d2494926c1d
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Avoid assertion violations in Rmail due to newline cache
    
     src/search.c (find_newline): Avoid assertion violations in
     CHAR_TO_BYTE when a portion of the buffer was deleted and we look
     for newlines near the end of the buffer.  This happens in Rmail
     hen JIT font-lock fontifies a newly displayed portion of the
     buffer.
---
 src/ChangeLog |    8 ++++++++
 src/search.c  |    6 ++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index a2ac538..ca5f85a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
+2015-02-28  Eli Zaretskii  <address@hidden>
+
+       * search.c (find_newline): Avoid assertion violations in
+       CHAR_TO_BYTE when a portion of the buffer was deleted and we look
+       for newlines near the end of the buffer.  This happens in Rmail
+       hen JIT font-lock fontifies a newly displayed portion of the
+       buffer.
+
 2015-02-23  Eli Zaretskii  <address@hidden>
 
        * w32fns.c (Fw32__menu_bar_in_use): New internal function.
diff --git a/src/search.c b/src/search.c
index eec642e..7364181 100644
--- a/src/search.c
+++ b/src/search.c
@@ -731,6 +731,12 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
                                               start, &next_change);
                if (result)
                  {
+                   /* When the cache revalidation is deferred,
+                      next-change might point beyond ZV, which will
+                      cause assertion violation in CHAR_TO_BYTE below.
+                      Limit next_change to ZV to avoid that.  */
+                   if (next_change > ZV)
+                     next_change = ZV;
                    start = next_change;
                    lim1 = next_change = end;
                  }



reply via email to

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