Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cm11F-0004P3-54 for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Mar 2017 16:34:25 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cm11E-0003hC-OE for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Mar 2017 16:34:24 +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.84_2) (envelope-from ) id 1cm11A-0003Sn-Pg for pgsql-bugs@postgresql.org; Thu, 09 Mar 2017 16:34:20 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cm114-0005Kn-B1; Thu, 09 Mar 2017 16:34:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v29GYAMi022576; Thu, 9 Mar 2017 11:34:10 -0500 From: Tom Lane To: Michael Meskes cc: "Dudley, Michael" , "pgsql-bugs@postgresql.org" Subject: Re: BUG #14582: ecpg crashes on SQL input In-reply-to: <20743.1489074536@sss.pgh.pa.us> References: <20170308165659.25059.69634@wrigleys.postgresql.org> <1489065869.2338.11.camel@postgresql.org> <1489071407.2338.19.camel@postgresql.org> <20743.1489074536@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 09 Mar 2017 10:48:56 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22574.1489077250.1@sss.pgh.pa.us> Date: Thu, 09 Mar 2017 11:34:10 -0500 Message-ID: <22575.1489077250@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org I wrote: > Wow, that's certainly a bug fix, and it does stop the crash in 9.6 for me, > but I'm not sure that I follow how come the failure seems to be version- > and data-dependent. It looks like, because of this bug, you ought to > reliably have a double free() occurring any time there's more than one > dollar-quoted constant in ecpg's input. Why doesn't glibc notice? After some googling, the answer seems to be that glibc's detection of double free() is really unreliable for small chunks. It will basically only notice an extra free of the same chunk most recently freed within a given bin (size range). Since in the problem at hand there are probably unrelated free's happening between the two free's mentioning the same chunk, it's quite easy for it to miss the error. I'm still a bit unsure why I see the crash in 9.6 but not HEAD, because there's very little difference between them, but I no longer feel that we need to investigate more closely. This all suggests that it might be worth testing ecpg with a debugging malloc library that has more robust error detection ... regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs