From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73870: 30.0.91; Segmentation fault when enabling php-ts-mode in an empty buffer Date: Sat, 19 Oct 2024 09:31:04 +0300 Message-ID: <86iktomwnr.fsf@gnu.org> References: <87r08dxh9l.fsf@ice9.digital> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12990"; mail-complaints-to="usenet@ciao.gmane.io" Cc: v.pupillo@gmail.com, 73870@debbugs.gnu.org To: Morgan Willcock , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 19 08:34:04 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t232J-0003Ed-UL for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Oct 2024 08:34:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t231x-0006wX-7m; Sat, 19 Oct 2024 02:33:41 -0400 Original-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 1t231v-0006wM-Fn for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 02:33:39 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t231v-0006dA-0T for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 02:33:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=TObRQdQvIRAdP7I4nvNtPSaPSg/jE5IMR5V3U7Bgz4k=; b=EM/9qltTtay5bX/wbAN3FgBrGUzhEJ6LiZQUKN1D5uzToX0rAIZkl/lXT3UblRNzScn1aifq59NvjgDlJa29AxqjSgx8vQMW5w42xOe+tqZp9bPwLutPu3q2bjEm8mg8zOiqnQYZwGNZOOkY5SUeLk8A5OJs293V6LyO0F1LOVZPkyzPxwbg+o+cBfY5nKRi1uaKvtzKDrytqmW4Vmf1O6/lb094if+G1xn7viAPLnHcvn8X2M6nmvOZgPuSgaBHbz7OXGVTCD+GZhl0Op0Vii8p4tcMyAx8OUQxxduafPUG4fOM2pzGmeHh4U63+7LgM9fhgTkAzuTZuQAA5i70vQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t232I-0005bt-9g for bug-gnu-emacs@gnu.org; Sat, 19 Oct 2024 02:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2024 06:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73870 X-GNU-PR-Package: emacs Original-Received: via spool by 73870-submit@debbugs.gnu.org id=B73870.172931963121545 (code B ref 73870); Sat, 19 Oct 2024 06:34:02 +0000 Original-Received: (at 73870) by debbugs.gnu.org; 19 Oct 2024 06:33:51 +0000 Original-Received: from localhost ([127.0.0.1]:41019 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2327-0005bR-6Y for submit@debbugs.gnu.org; Sat, 19 Oct 2024 02:33:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t2325-0005bA-Nn for 73870@debbugs.gnu.org; Sat, 19 Oct 2024 02:33:50 -0400 Original-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 1t22zU-0006Q7-7U; Sat, 19 Oct 2024 02:31:08 -0400 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=TObRQdQvIRAdP7I4nvNtPSaPSg/jE5IMR5V3U7Bgz4k=; b=o69bWY8bTqm+ sVgQWFxRpIGCrQvG2jmYdf/x8H2aG8lU5Ain5EPj8SOUlCf/+J65xtwXtCpaOeDmTdvkmEXNFG0OE cGlNZDXDaU+p3RmTs3yuBlr7QiuI0mkApAgh8UCvPYMO/8igVX3ErnneL6BJYn/vCiZo673OUQXn3 v8hS97zDzTJ/C2Y0jR5rV6lSU9nVmHzFn+CGy0myUDucu4Qmp+Cm9m63/hFwApAYxjaFaGNEgKhHp 0may6aE8rVH+Vkogq3umYZzGtEENEJ2/7xiCPE38ggbUGWDqXEkYVXj9Cw9x1qTdjEr0irqzVDnwF QHkFQTIMc/kvvH/LPuLX0Q==; In-Reply-To: <87r08dxh9l.fsf@ice9.digital> (message from Morgan Willcock on Fri, 18 Oct 2024 21:55:50 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293830 Archived-At: > Cc: v.pupillo@gmail.com > From: Morgan Willcock > Date: Fri, 18 Oct 2024 21:55:50 +0100 > > > > I have a reproducible segfault when enabling php-ts-mode (grammars have > been installed with php-ts-mode-install-parsers): > > emacs -Q \ > --eval "(find-file \"/tmp/newfile\")" \ > --eval "(php-ts-mode)" > > The error doesn't occur when the buffer is not empty, so this doesn't > crash: > > emacs -Q \ > --eval "(find-file \"/tmp/newfile\")" \ > --eval "(insert \"a\")" \ > --eval "(php-ts-mode)" > > Here is a backtrace: > > (gdb) run > Starting program: /home/mwillcock/build/emacs-30.0.91/src/emacs -Q --eval \(find-file\ \"/tmp/newfile\"\) --eval \(php-ts-mode\) > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". > [New Thread 0x7ffff1a476c0 (LWP 70615)] > [New Thread 0x7ffff12466c0 (LWP 70616)] > [New Thread 0x7ffff0a456c0 (LWP 70617)] > > Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. > 0x00005555558ee950 in treesit_sync_visible_region (parser=...) at treesit.c:1087 > 1087 new_ranges[new_len - 1].end_byte = new_end; > (gdb) bt full > #0 0x00005555558ee950 in treesit_sync_visible_region (parser=...) at treesit.c:1087 > new_ranges = 0x555556b02e10 > tree = 0x555556b03ab0 > buffer = 0x555556109100 > visible_beg = 1 > visible_end = 1 > len = 1 > ranges = 0x5555568d73a0 > new_len = 0 > new_end = 0 > #1 0x00005555558eed56 in treesit_ensure_parsed (parser=...) at treesit.c:1156 > buffer = 0x555556109100 > treesit_parser = 0x0 > tree = 0x5555558edc7b > input = {payload = 0x7fffffffa420, read = 0x5555558ec9b7 , encoding = TSInputEncodingUTF8} > new_tree = 0x7fffffffa440 The implementation of that function was significantly modified on the emacs-30 release branch, so the code which segfaults for you is no longer there. Can you try the current emacs-30 branch and see if the problem still happens there? If it does, please show a backtrace from that version. Thanks. P.S. Adding Yuan, in case he has some comments.