From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 09:54:54 2023 Received: (at submit) by debbugs.gnu.org; 5 Feb 2023 14:54:54 +0000 Received: from localhost ([127.0.0.1]:44475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgPu-0001r2-6a for submit@debbugs.gnu.org; Sun, 05 Feb 2023 09:54:54 -0500 Received: from lists.gnu.org ([209.51.188.17]:36756) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgPs-0001qu-Jr for submit@debbugs.gnu.org; Sun, 05 Feb 2023 09:54:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOgPs-00065b-D2 for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 09:54:52 -0500 Received: from mx3.muc.de ([193.149.48.5]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOgPn-0005ei-Un for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 09:54:51 -0500 Received: (qmail 79933 invoked by uid 3782); 5 Feb 2023 15:54:36 +0100 Received: from acm.muc.de (p4fe1529c.dip0.t-ipconnect.de [79.225.82.156]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 05 Feb 2023 15:54:35 +0100 Received: (qmail 19396 invoked by uid 1000); 5 Feb 2023 14:54:35 -0000 Date: Sun, 5 Feb 2023 14:54:35 +0000 To: bug-gnu-emacs@gnu.org Subject: Emacs 29.0.60: font-lock throws an args-out-of-range error with a long line. Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.5; envelope-from=acm@muc.de; helo=mx3.muc.de X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Hello, Emacs. This bug is reproducible in both the master branch and release branch as updated yesterday evening (European time). To reproduce this bug: (i) Apply this bug fix to CC Mode, and byte compile the defun (or file), and make sure it's loaded: diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 2631c24f8db..9fa727d9e1f 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -5915,19 +5915,21 @@ c-determine-limit (cond ((> pos start) ; Nothing but literals base) - ((> base (point-min)) + ((and + (> base (point-min)) + (> (- base try-size) (point-min))) ; prevent infinite recursion. (c-determine-limit how-far-back base (* 2 try-size) org-start)) (t base))) ((>= count how-far-back) (c-determine-limit-no-macro - (+ (car elt) (- count how-far-back)) - org-start)) + (+ (car elt) (- count how-far-back)) + org-start)) ((eq base (point-min)) (point-min)) ((> base (- start try-size)) ; Can only happen if we hit point-min. (c-determine-limit-no-macro - (car elt) - org-start)) + (car elt) + org-start)) (t (c-determine-limit (- how-far-back count) base (* 2 try-size) org-start)))))) (ii) M-: (setq backtrace-on-redisplay-error t) (iii) C-x b temp.cc. M-x c++-mode. (iv) Type in the following text: char foo [] = R"foo( )foo" (v) With point at the end of the first line in temp.cc, M-: (insert (make-string 260000 ?y)) This may take some time to execute. (vi) C-x 4 b *Redisplay_trace* The following backtrace will be seen: Error: args-out-of-range (260028 260028) mapbacktrace(#f(compiled-function (evald func args flags) #)) debug-early-backtrace() debug-early(error (args-out-of-range 260028 260028)) <=============== get-text-property(260028 font-lock-multiline) font-lock-extend-region-multiline() font-lock-default-fontify-region(1 260029 nil) c-font-lock-fontify-region(1 1501 nil) font-lock-fontify-region(1 1501) #f(compiled-function (fun) #)(font-lock-fontify-region) run-hook-wrapped(#f(compiled-function (fun) #) font-lock-fontify-region) jit-lock--run-functions(1 1501) jit-lock-fontify-now(1 1501) jit-lock-function(1) redisplay_internal\ \(C\ function\)() This is clearly a bug. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Position 260028 is within the bounds of the buffer. It would appear that the new-ish long-lines code has narrowed the buffer at some stage such that point-max is less than the end of the buffer. I propose the following simple patch which fixes (or works around) this bug: diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 1fa45379b9f..9e944fe188a 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1154,6 +1154,8 @@ font-lock-default-fontify-region "Fontify the text between BEG and END. If LOUDLY is non-nil, print status messages while fontifying. This function is the default `font-lock-fontify-region-function'." + (or (<= end (point-max)) + (setq end (point-max))) (with-silent-modifications ;; Use the fontification syntax table, if any. (with-syntax-table (or font-lock-syntax-table (syntax-table)) -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 10:12:43 2023 Received: (at 61298) by debbugs.gnu.org; 5 Feb 2023 15:12:43 +0000 Received: from localhost ([127.0.0.1]:46281 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgh9-0002lW-6N for submit@debbugs.gnu.org; Sun, 05 Feb 2023 10:12:43 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58508) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOgh6-0002lJ-Mw for 61298@debbugs.gnu.org; Sun, 05 Feb 2023 10:12:41 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOgh0-0008R6-T9; Sun, 05 Feb 2023 10:12:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=5V1BQ1VNtqIWzs4O3oGMsdTnn7+DTdlVPWYy5FGoxxE=; b=QDWy7e3k7o/4 SrsEWFy0fRMjuifYV9dA2FKGsUl0VwojjKLI9mj+fZNrn92HHnxktWu2p4fbbzv+UGD8pVg4m+pYy ArrRTMDHlsWJ93vxoN4RTFuD8IuE/KANd/lHn+JzSXXY3wpuoKBKP4UiJJbpl4CCRGgjPbI1NaELU 8RI8gJvYR2RIfAS0IkMhZYpWuAiMWIMprE02vVjo2PXyCh7F+3cPBSebKzMapUcQWzTQKgmLsxM8l 4fGheFANejUFLR9p6S49j+NVSsMemJAfjWruBEenRFt2XRvOv/WucmRfwFdAq9LcmjwbZMdlAMTJ7 RD/s9mABp98c2CMLHvyVQA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pOggz-0001B1-CO; Sun, 05 Feb 2023 10:12:33 -0500 Date: Sun, 05 Feb 2023 17:12:42 +0200 Message-Id: <83v8kgqh79.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-Reply-To: (message from Alan Mackenzie on Sun, 5 Feb 2023 14:54:35 +0000) Subject: Re: bug#61298: Emacs 29.0.60: font-lock throws an args-out-of-range error with a long line. References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 61298 Cc: 61298@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sun, 5 Feb 2023 14:54:35 +0000 > From: Alan Mackenzie > > Error: args-out-of-range (260028 260028) > mapbacktrace(#f(compiled-function (evald func args flags) #)) > debug-early-backtrace() > debug-early(error (args-out-of-range 260028 260028)) <=============== > get-text-property(260028 font-lock-multiline) > font-lock-extend-region-multiline() > font-lock-default-fontify-region(1 260029 nil) > c-font-lock-fontify-region(1 1501 nil) > font-lock-fontify-region(1 1501) > #f(compiled-function (fun) #)(font-lock-fontify-region) > run-hook-wrapped(#f(compiled-function (fun) #) font-lock-fontify-region) > jit-lock--run-functions(1 1501) > jit-lock-fontify-now(1 1501) > jit-lock-function(1) > redisplay_internal\ \(C\ function\)() > > This is clearly a bug. > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > Position 260028 is within the bounds of the buffer. It would appear > that the new-ish long-lines code has narrowed the buffer at some stage > such that point-max is less than the end of the buffer. I propose the > following simple patch which fixes (or works around) this bug: Fine with me, please install on the emacs-29 branch, and thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 05 11:04:16 2023 Received: (at 61298-done) by debbugs.gnu.org; 5 Feb 2023 16:04:16 +0000 Received: from localhost ([127.0.0.1]:46311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOhV1-00044o-ON for submit@debbugs.gnu.org; Sun, 05 Feb 2023 11:04:16 -0500 Received: from mx3.muc.de ([193.149.48.5]:34052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOhV0-00044b-2Q for 61298-done@debbugs.gnu.org; Sun, 05 Feb 2023 11:04:14 -0500 Received: (qmail 22790 invoked by uid 3782); 5 Feb 2023 17:04:07 +0100 Received: from acm.muc.de (p4fe1529c.dip0.t-ipconnect.de [79.225.82.156]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 05 Feb 2023 17:04:07 +0100 Received: (qmail 23424 invoked by uid 1000); 5 Feb 2023 16:04:05 -0000 Date: Sun, 5 Feb 2023 16:04:05 +0000 To: Eli Zaretskii Subject: Re: bug#61298: Emacs 29.0.60: font-lock throws an args-out-of-range error with a long line. Message-ID: References: <83v8kgqh79.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83v8kgqh79.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 61298-done Cc: 61298-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Eli. On Sun, Feb 05, 2023 at 17:12:42 +0200, Eli Zaretskii wrote: > > Date: Sun, 5 Feb 2023 14:54:35 +0000 > > From: Alan Mackenzie > > Error: args-out-of-range (260028 260028) > > mapbacktrace(#f(compiled-function (evald func args flags) #)) > > debug-early-backtrace() > > debug-early(error (args-out-of-range 260028 260028)) <=============== > > get-text-property(260028 font-lock-multiline) > > font-lock-extend-region-multiline() > > font-lock-default-fontify-region(1 260029 nil) > > c-font-lock-fontify-region(1 1501 nil) > > font-lock-fontify-region(1 1501) > > #f(compiled-function (fun) #)(font-lock-fontify-region) > > run-hook-wrapped(#f(compiled-function (fun) #) font-lock-fontify-region) > > jit-lock--run-functions(1 1501) > > jit-lock-fontify-now(1 1501) > > jit-lock-function(1) > > redisplay_internal\ \(C\ function\)() > > This is clearly a bug. > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; > > Position 260028 is within the bounds of the buffer. It would appear > > that the new-ish long-lines code has narrowed the buffer at some stage > > such that point-max is less than the end of the buffer. I propose the > > following simple patch which fixes (or works around) this bug: > Fine with me, please install on the emacs-29 branch, and thanks. I have done so, and I'm closing the bug with this post. Thanks for such a rapid response. -- Alan Mackenzie (Nuremberg, Germany). From unknown Thu Aug 21 12:10:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 06 Mar 2023 12:24:11 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator