Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdvcy-0008Qt-Oi for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Jul 2018 10:48:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fdvcw-00081M-V5 for pgsql-hackers@arkaria.postgresql.org; Fri, 13 Jul 2018 10:48:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fdvcw-00081C-L2 for pgsql-hackers@lists.postgresql.org; Fri, 13 Jul 2018 10:48:42 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fdvct-0004cg-HS for pgsql-hackers@postgresql.org; Fri, 13 Jul 2018 10:48:41 +0000 Received: from peanuts2.localnet ([109.190.80.176]) by mrelayeu.kundenserver.de (mreue002 [212.227.15.168]) with ESMTPSA (Nemesis) id 0M5lI9-1fxxSH1ZDl-00xqsB for ; Fri, 13 Jul 2018 12:48:36 +0200 From: Pierre Ducroquet To: pgsql-hackers@postgresql.org Subject: Re: function lca('{}'::ltree[]) caused DB Instance crash Date: Fri, 13 Jul 2018 12:48:35 +0200 Message-ID: <4285558.KOck4HGOto@peanuts2> In-Reply-To: <5b0d8e4f-f2a3-1305-d612-e00e35a7be66@qunar.com> References: <5b0d8e4f-f2a3-1305-d612-e00e35a7be66@qunar.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1817942.ho57aeQrzV" Content-Transfer-Encoding: 7Bit X-Provags-ID: V03:K1:fWYcUPWQPMOusXo0jQZaeIbkpIy1YalN4Vbh4f1DytR2KVOEwM4 I/eZKY2kHeNWkpHM+hsqKnB5XZdty+e+NhnPzWyx3t3Gd72toWhQuX8hmBrLjpYFumVhEas IoNheMK7QQWzl3J6XDBOLpzSgZxZojTPM34BOb8c47PXg2xGCtmeBZf589wnRIzBECwz7et KmCXmoXWJy2651sWGNazA== X-UI-Out-Filterresults: notjunk:1;V01:K0:HxBGqrOG56Y=:S0QuHGUM70eN0PnN3YUSm7 ITrMGsnj+NW9QxxAQI3v39gWOz5xwnd5JxIaF3f6H3NFuTZYVUpMvpvqHk6QVMhH62X4e77Ek EOI0ohWMHdqwkENC8oxsLpLT+o5Dn7KaFAjaUBCKHfqwvUkdLPSdbaDShi/JaAezw2s8nj4nr bPhX6L8RuTes+ojgTfLGGX/YaqGEuwjjQf+JnVax2phwIGeeMVfWYSJoNh9/Utn52AdtYvr1o qJzEaRe2mZ/QHU94MrQ08OY/Q6kreAH1rV9ZqjZoqBv//USNuHTOLuYhcvjgS2cS23W3ctLDX o4oyYUKwiw3/KXHwlDgtikZSUQU3EWnF9ydOGP1cFYPf3oaoTXg60HkcK3M6KZl/SEsh9PX1z i+4S6U9j89SEYPueOs9R3tdyetn8QPAz+bTM2supPJOgvLMKPeTdmTv07zOqXT/TLhPE58qAv kXycir8+rsGHfIGBgGcMmcaADPQFi+qrj4LhVnH1uQqp6ufYSvKR1UpnwdrY1PtLzMV9pLjw+ W9RAsqoggmWNpDP0TMQf2Z4/Zh1jFvnPPCYD5hhEclRMGf2U/tCkmSKrM1AUt2jVMpd7yyceY t1SnI7pTvlpc4LQMltB700irZwgagyWRbMvt4eWb1SZ01fdIgsx6Bkn0Rh46+NUoSbjS9LnrP zg2NuAjI06fUJgIdVLRVZn7evLhuC2om3rF43kH+1k8hzTHbvqAV+hld1obqNQzZFimw= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --nextPart1817942.ho57aeQrzV Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" On Friday, July 13, 2018 12:09:20 PM CEST =E6=9D=8E=E6=B5=B7=E9=BE=99 wrote: > HI,Oleg && pgsql-hackers >=20 > Plese help me to check this is a bug of ltree? >=20 Hi There is indeed a bug. The _lca function in _ltree_op.c tries to allocate 0= =20 bytes of memory, doesn't initialize it and dereference it in lca_inner. The attached basic patch fixes it. Regards Pierre --nextPart1817942.ho57aeQrzV Content-Disposition: attachment; filename="0001-Fix-segfault-with-lca-ltree.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="0001-Fix-segfault-with-lca-ltree.patch"