Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptSCS-0002wa-Sb for pgsql-bugs@arkaria.postgresql.org; Mon, 01 May 2023 12:00:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ptSCR-0003e7-N0 for pgsql-bugs@arkaria.postgresql.org; Mon, 01 May 2023 12:00:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptSCR-0003dy-EU for pgsql-bugs@lists.postgresql.org; Mon, 01 May 2023 12:00:11 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ptSCK-0069bf-MX for pgsql-bugs@lists.postgresql.org; Mon, 01 May 2023 12:00:10 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-4efea4569f5so2926086e87.3 for ; Mon, 01 May 2023 05:00:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682942404; x=1685534404; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Y5nJ5YoE/Wm+oCoDi+m8oAehrvZf6IPi7Yz/vAPNHss=; b=SpV6RGWYhzRRia1Thghr2L5dVl/vISyK/xv6bOMuGZPXkRlGx08DGB/at3xCV9ejRh h80bTxKujT3vC2tHuXq0mVKzOaPkvRQZmybkuYPzlWZT0J1fZa7DTomtIkISE0uAVPiJ qiyfM0pIPzhMqX2MrZQDHW1UFUAQclMU+wARIYWgNRQByovtMk6EUTWuke2o5eahXmht kq6dO9fko5B0/Nz5C3dN3sH5dVC3BvNRM8ohDGSrPq9kUt9vwINbVeMkGfJr7g9hwB0/ AgOToQUODxYWEoqSHbJSMuNgOsGgwM7WQf6xfvde+Vozx9lTYqzqnT/De4G+lil+uJ74 ALvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682942404; x=1685534404; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Y5nJ5YoE/Wm+oCoDi+m8oAehrvZf6IPi7Yz/vAPNHss=; b=Oixl1G2LiK3rbhAdlNfYY5S/JLcF4s+CCzf1XJlqOfnUqMZMlscyrezDBCKan5/PL7 HTPV6kDbw/+btnColsRO9+v7mwYipqBElGro/lp6guDy72hF5bS7An57UoeKj26EBkXt VJFIO8lCMpoEQJGwoxBKEWBbqJ2cdtf13zj6bAPQ6sreggf6M2Qh6NBG+3TrM7peCSaf um9LZoX88Hny5+xaLHOlX9FekNhKumtGyO8dlNuWGcgfIY8N30YwhfLM428ZoHJXp+jR qH/bQBCKzWvGvuqXXKRjhyYG4JmG2eyVTl6pyKl3Fq5hEli/+rpJSfFi5MtU7R4FJTgK 06gQ== X-Gm-Message-State: AC+VfDwnBhXLPiqam3OTxzs1r/k4AcLm7PQ+x691aKUvtmUzhAXrtegr o9TkpHpmDprOk76OCtz3R4I= X-Google-Smtp-Source: ACHHUZ40TaV/WLmPu08SQEW3yddDe+MixvdWbMx7U+L659rgxAJhx3ujAEZ6wBwCBqr6/fcdDans4Q== X-Received: by 2002:a05:6512:21c:b0:4ef:d3b7:62db with SMTP id a28-20020a056512021c00b004efd3b762dbmr3660319lfo.37.1682942402958; Mon, 01 May 2023 05:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.28.115]) by smtp.gmail.com with ESMTPSA id l10-20020ac2554a000000b004edc7633179sm4666309lfk.292.2023.05.01.05.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 01 May 2023 05:00:02 -0700 (PDT) Message-ID: <9cd163da-d096-7e9e-28f6-f3620962a660@gmail.com> Date: Mon, 1 May 2023 15:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: BUG #17912: Invalid memory access when converting plpython' array containing empty array Content-Language: en-US To: Tom Lane Cc: pgsql-bugs@lists.postgresql.org References: <17912-82ceed78731d9cdc@postgresql.org> <1392974.1682694846@sss.pgh.pa.us> <1440309.1682705916@sss.pgh.pa.us> <1483429.1682709429@sss.pgh.pa.us> <5ebae5e4-d401-fadf-8585-ac3eaf53219c@gmail.com> <1805878.1682788590@sss.pgh.pa.us> <2073074.1682871878@sss.pgh.pa.us> From: Alexander Lakhin In-Reply-To: <2073074.1682871878@sss.pgh.pa.us> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 30.04.2023 19:24, Tom Lane wrote: > Here's a version that adopts plperl's logic, causing it to treat > empty sub-lists as being zero-length dimensions. Most of the new > test cases are borrowed from plperl, too, and most of them act > differently before and after the code change. So I'm pretty > hesitant to put this into stable branches. OTOH, maybe it's not > too late for v16? Thanks for the patch! I've tested the new implementation and found no issues with it — only rectangular structures are accepted now. The code is straightforward and very similar to plperl's, so I would not expect that it might bring new anomalies, which couldn't be seen before. Thus I don't think that adding it to current master (and possible follow-up fixing) can take a significant amount of time out of v16+ schedule only. > I noticed one inarguable bug here, too: PLySequence_ToArray_recurse > leaks Python object refcounts after errors, because it has no > PG_TRY to ensure that Py_XDECREF() gets done. I'm not sure if > it's worth doing something about that in the back branches, given > the lack of complaints. I continue watching the array handling bugs dancing Sirtaki too. Now it's another asymmetry: select '{{1},{{2}}}'::int[];  {{{1}},{{2}}} but: select '{{{1}},{2}}'::int[];  {} Reproduced on REL_11_STABLE..master. Best regards, Alexander