Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZ8V4-00GXoj-5Y for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Jul 2025 13:36:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uZ8V2-008ZHF-0p for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Jul 2025 13:36:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uZ8V1-008ZH7-OV for pgsql-bugs@lists.postgresql.org; Tue, 08 Jul 2025 13:36:44 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uZ8V0-006EBD-1x for pgsql-bugs@lists.postgresql.org; Tue, 08 Jul 2025 13:36:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 568DabcF689496; Tue, 8 Jul 2025 09:36:37 -0400 From: Tom Lane To: Michael Paquier cc: Robin Haberkorn , Jim Jones , pgsql-bugs@lists.postgresql.org, maralist86@mail.ru Subject: Re: BUG #18943: Return value of a function 'xmlBufferCreate' is dereferenced at xpath.c:177 without checking for NUL In-reply-to: References: <861593.1748970933@sss.pgh.pa.us> <31f3480e-cd7d-4021-b392-87922572cc37@uni-muenster.de> Comments: In-reply-to Michael Paquier message dated "Tue, 08 Jul 2025 20:23:30 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <689494.1751981797.1@sss.pgh.pa.us> Date: Tue, 08 Jul 2025 09:36:37 -0400 Message-ID: <689495.1751981797@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Michael Paquier writes: > On Tue, Jul 08, 2025 at 09:49:20AM +0000, Robin Haberkorn wrote: >> I know this has already been committed, but why are we still using >> PG_XML_STRICTNESS_LEGACY in xpath.c? As we are always checking >> pg_xml_error_occurred() this should no longer be necessary. > Are you sure that you can do that? The comment in xml_errorHandler() argues * Legacy error handling mode. err_occurred is never set, we just add the * message to err_buf. This mode exists because the xml2 contrib module * uses our error-handling infrastructure, but we don't want to change its * behaviour since it's deprecated anyway. This is also why we don't * distinguish between notices, warnings and errors here --- the old-style * generic error handler wouldn't have done that either. So switching to _ALL (or even _WELL_FORMED) mode would result in nontrivial differences in the behavior of xpath.c's functions with bad input. Maybe that's a reasonable thing to do, but it's a question of user-visible behavior not just code cleanliness. regards, tom lane