Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cm0K2-0001xJ-RI for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Mar 2017 15:49:46 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cm0K2-0003bb-E4 for pgsql-bugs@arkaria.postgresql.org; Thu, 09 Mar 2017 15:49:46 +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 1cm0JL-0001nf-Mo for pgsql-bugs@postgresql.org; Thu, 09 Mar 2017 15:49:03 +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 1cm0JJ-0004QR-9u; Thu, 09 Mar 2017 15:49:02 +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 v29FmuiI020744; Thu, 9 Mar 2017 10:48:56 -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: <1489071407.2338.19.camel@postgresql.org> References: <20170308165659.25059.69634@wrigleys.postgresql.org> <1489065869.2338.11.camel@postgresql.org> <1489071407.2338.19.camel@postgresql.org> Comments: In-reply-to Michael Meskes message dated "Thu, 09 Mar 2017 15:56:47 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20742.1489074536.1@sss.pgh.pa.us> Date: Thu, 09 Mar 2017 10:48:56 -0500 Message-ID: <20743.1489074536@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 Michael Meskes writes: > Could you try the attached patch please? 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? I think that in most cases, the malloc block used for dolqstart would have been handed out again for another temporary string by the time we reach the second dollar-quoted constant, so the second free(dolqstart) in itself wouldn't look like an error to glibc. But when the temporary string is freed for real, a bit later, that should result in an error. Does ecpg leak a large fraction of its temporary strings? 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