Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsALb-0002XH-6H for pgsql-bugs@arkaria.postgresql.org; Fri, 08 Feb 2019 17:53:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gsALZ-0001fB-Oq for pgsql-bugs@arkaria.postgresql.org; Fri, 08 Feb 2019 17:53:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsALZ-0001cd-Eu for pgsql-bugs@lists.postgresql.org; Fri, 08 Feb 2019 17:53:53 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gsALX-0006OP-05 for pgsql-bugs@lists.postgresql.org; Fri, 08 Feb 2019 17:53:52 +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 x18HrmQ8032331; Fri, 8 Feb 2019 12:53:48 -0500 From: Tom Lane To: skgsergio@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15624: Sefgault when xml_errorHandler receives a null error->message from libxml2 In-reply-to: <15624-4dea54091a2864e6@postgresql.org> References: <15624-4dea54091a2864e6@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Fri, 08 Feb 2019 11:29:32 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <32329.1549648428.1@sss.pgh.pa.us> Date: Fri, 08 Feb 2019 12:53:48 -0500 Message-ID: <32330.1549648428@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > Although libxml2 tries not to return a null message but both their xmlStrdup > function and XML_GET_VAR_STR can return null in a OOM scenario. Ugh. > - appendStringInfoString(errorBuf, error->message); > + if (error->message != NULL) > + appendStringInfoString(errorBuf, error->message); I'm inclined to do something more like + if (error->message != NULL) + appendStringInfoString(errorBuf, error->message); + else + appendStringInfoString(errorBuf, "(no message provided)"); else the output will read very oddly in this situation. Thanks for the report! regards, tom lane