Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sDGTl-00BSOO-7B for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Jun 2024 04:36:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sDGTj-000E63-VZ for pgsql-hackers@arkaria.postgresql.org; Sat, 01 Jun 2024 04:36:27 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sDGTj-000E5v-H2 for pgsql-hackers@lists.postgresql.org; Sat, 01 Jun 2024 04:36:27 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sDGTc-001mYU-8g for pgsql-hackers@lists.postgresql.org; Sat, 01 Jun 2024 04:36:26 +0000 Received: from [172.30.10.118] (unknown [172.30.10.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.kozhemyakin@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 90FCBE21124 for ; Sat, 1 Jun 2024 07:36:18 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1717216578; bh=mhEOtCghsBiG2X2ZjR4Ab2V/VVjm9s7RU1hYz9b+Pdw=; h=Message-ID:Date:User-Agent:To:From:Subject:From; b=Sgl16ZOj+pWKGBf/hdiD+eacyT7p723WSGvI+VmEizVr9eQ83wg7GC/3G2Gn5YPtx XdRd1tS4Ypa99Ne2w3nl/sg0191OqAjP5o/RtJf8gF7dG2vZxyQRIFRYtgAJSKNEEZ aOO0V6eraQwM7cxxqPb7TDSs0oKboORbK/22CTcZwcCMzEzPMC34lFL8mNg/d50FRE W3NBrMVymVQhRix7YMfee8f+D8vqAIxKh7zmuimlrIHvcIxoxxWeFr5aHJD6Q8oefR Jf8/77OhJEl5Y7zc8ceVX0NWI3eBFb1wi63gXlljwGUEEj2H5bamF6NvUeR5Jwcot7 i9/okYaQTiLzQ== Message-ID: <6a2a1c40-2b2c-4a33-8b72-243c0766fcda@postgrespro.ru> Date: Sat, 1 Jun 2024 11:36:18 +0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: ru To: pgsql-hackers@lists.postgresql.org From: "a.kozhemyakin" Subject: pltcl crashes due to a syntax error Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2024/05/31 00:20:00 #25364009 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello hackers, When executing the following query on master branch: CREATE EXTENSION pltcl; CREATE or replace PROCEDURE test_proc5(INOUT a text)         LANGUAGE pltcl         AS $$         set aa [concat $1 "+" $1]         return [list $aa $aa])         $$; CALL test_proc5('abc'); CREATE EXTENSION CREATE PROCEDURE server closed the connection unexpectedly         This probably means the server terminated abnormally         before or while processing the request. The connection to the server was lost. Attempting reset: Failed. The connection to the server was lost. Attempting reset: Failed. Core was generated by `postgres: postgres postgres [loca'. Program terminated with signal SIGSEGV, Segmentation fault. #0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142 142     ../sysdeps/x86_64/multiarch/strlen-sse2.S: No such file or directory. (gdb) bt #0  __strlen_sse2 () at ../sysdeps/x86_64/multiarch/strlen-sse2.S:142 #1  0x00007f5f1353ba6a in utf_u2e (src=0x0) at pltcl.c:77 #2  0x00007f5f1353c9f7 in throw_tcl_error (interp=0x55ec24bdaf70, proname=0x55ec24b6b140 "test_proc5") at pltcl.c:1373 #3  0x00007f5f1353ed64 in pltcl_func_handler (fcinfo=fcinfo@entry=0x7ffdbfb407a0, call_state=call_state@entry=0x7ffdbfb405d0, pltrusted=pltrusted@entry=true) at pltcl.c:1029 #4  0x00007f5f1353ee8d in pltcl_handler (fcinfo=0x7ffdbfb407a0, pltrusted=pltrusted@entry=true) at pltcl.c:765 #5  0x00007f5f1353f1ef in pltcl_call_handler (fcinfo=) at pltcl.c:698 #6  0x000055ec239ec64a in ExecuteCallStmt (stmt=stmt@entry=0x55ec24a9a940, params=params@entry=0x0, atomic=atomic@entry=false, dest=dest@entry=0x55ec24a6ea18) at functioncmds.c:2285 #7  0x000055ec23c103a7 in standard_ProcessUtility (pstmt=0x55ec24a9a9d8, queryString=0x55ec24a99e68 "CALL test_proc5('abc');", readOnlyTree=, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x55ec24a6ea18,     qc=0x7ffdbfb40f40) at utility.c:851 #8  0x000055ec23c1081b in ProcessUtility (pstmt=pstmt@entry=0x55ec24a9a9d8, queryString=, readOnlyTree=, context=context@entry=PROCESS_UTILITY_TOPLEVEL, params=, queryEnv=,     dest=0x55ec24a6ea18, qc=0x7ffdbfb40f40) at utility.c:523 #9  0x000055ec23c0e04e in PortalRunUtility (portal=portal@entry=0x55ec24b18108, pstmt=0x55ec24a9a9d8, isTopLevel=isTopLevel@entry=true, setHoldSnapshot=setHoldSnapshot@entry=true, dest=dest@entry=0x55ec24a6ea18, qc=qc@entry=0x7ffdbfb40f40)     at pquery.c:1158 #10 0x000055ec23c0e3b7 in FillPortalStore (portal=portal@entry=0x55ec24b18108, isTopLevel=isTopLevel@entry=true) at pquery.c:1031 #11 0x000055ec23c0e6ee in PortalRun (portal=portal@entry=0x55ec24b18108, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, dest=dest@entry=0x55ec24a9aec8, altdest=altdest@entry=0x55ec24a9aec8,     qc=0x7ffdbfb41130) at pquery.c:763 #12 0x000055ec23c0acca in exec_simple_query (query_string=query_string@entry=0x55ec24a99e68 "CALL test_proc5('abc');") at postgres.c:1274 #13 0x000055ec23c0caad in PostgresMain (dbname=, username=) at postgres.c:4680 #14 0x000055ec23c0687a in BackendMain (startup_data=, startup_data_len=) at backend_startup.c:105 #15 0x000055ec23b766bf in postmaster_child_launch (child_type=child_type@entry=B_BACKEND, startup_data=startup_data@entry=0x7ffdbfb41354 "", startup_data_len=startup_data_len@entry=4, client_sock=client_sock@entry=0x7ffdbfb41390)     at launch_backend.c:265 #16 0x000055ec23b7ab36 in BackendStartup (client_sock=client_sock@entry=0x7ffdbfb41390) at postmaster.c:3593 #17 0x000055ec23b7adb0 in ServerLoop () at postmaster.c:1674 #18 0x000055ec23b7c20c in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x55ec24a54030) at postmaster.c:1372 #19 0x000055ec23aacf9f in main (argc=3, argv=0x55ec24a54030) at main.c:197