Subject: bug#7952: 24.0.50; crash in find_interval

From: Stefan Monnier <[email-masked]>
Date: Sat, 30 Apr 2011 10:16:44 -0300

>> Not sure if it's related, but using grep results in lots of those in
>> the Messages buffer:
>> 
>> | Error during redisplay: (args-out-of-range 26100 26140)
>> | Error during redisplay: (args-out-of-range 55792 55803)
>> | Error during redisplay: (args-out-of-range 89118 89155)
>> | Error during redisplay: (args-out-of-range 107767 107804)
>> | Error during redisplay: (args-out-of-range 119160 119176)
>> | Error during redisplay: (args-out-of-range 152422 152434)

> It's unrelated to the crash, but it's caused by the same reason:
> jit-lock's function jit-lock-fontify-now also assumes that buffer
> positions don't change as result of fontification.  The patch below,
> which uses markers for those positions that can change, seems to fix
> that.

> Before I commit this, I'd appreciate a review by Stefan (and anyone
> else who cares to comment), especially wrt to semi-kludgey updating of
> jit-lock-context-unfontify-pos (I wasn't sure making it a marker would
> be TRT).

As can be seen by a comment in grep.el, I consider grep's updating of
the buffer as a problem.  Also, we've seen other reasons why grep's
handling of escape sequences should be performed in the process filter
rather than in font-lock.  So I'd rather say that grep's use of
font-lock is wrong, rather than change jit-lock to accommodate it.

Your earlier fix that eliminates the crash is not affected by this
decision, because even bad Lisp code should not be able to crash Emacs
so easily, so even if it's triggered by grep.el's bad code, it still
needs to be fixed.

        Stefan