diff options
| author | Eli Zaretskii | 2015-02-28 12:33:32 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2015-02-28 12:33:32 +0200 |
| commit | f1601063f29c99be77d2513320ed6d2494926c1d (patch) | |
| tree | 823f2f78c679678f54d21e9e74be3dc1c7bd0d84 /src | |
| parent | 1b0ebbdb566a8dfa5f45ce121b2c835e9760091f (diff) | |
| download | emacs-f1601063f29c99be77d2513320ed6d2494926c1d.tar.gz emacs-f1601063f29c99be77d2513320ed6d2494926c1d.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/search.c | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a2ac5389f20..ca5f85a0157 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2015-02-28 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * search.c (find_newline): Avoid assertion violations in | ||
| 4 | CHAR_TO_BYTE when a portion of the buffer was deleted and we look | ||
| 5 | for newlines near the end of the buffer. This happens in Rmail | ||
| 6 | hen JIT font-lock fontifies a newly displayed portion of the | ||
| 7 | buffer. | ||
| 8 | |||
| 1 | 2015-02-23 Eli Zaretskii <eliz@gnu.org> | 9 | 2015-02-23 Eli Zaretskii <eliz@gnu.org> |
| 2 | 10 | ||
| 3 | * w32fns.c (Fw32__menu_bar_in_use): New internal function. | 11 | * w32fns.c (Fw32__menu_bar_in_use): New internal function. |
diff --git a/src/search.c b/src/search.c index eec642ecb20..73641813604 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, | |||
| 731 | start, &next_change); | 731 | start, &next_change); |
| 732 | if (result) | 732 | if (result) |
| 733 | { | 733 | { |
| 734 | /* When the cache revalidation is deferred, | ||
| 735 | next-change might point beyond ZV, which will | ||
| 736 | cause assertion violation in CHAR_TO_BYTE below. | ||
| 737 | Limit next_change to ZV to avoid that. */ | ||
| 738 | if (next_change > ZV) | ||
| 739 | next_change = ZV; | ||
| 734 | start = next_change; | 740 | start = next_change; |
| 735 | lim1 = next_change = end; | 741 | lim1 = next_change = end; |
| 736 | } | 742 | } |