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 1rPfWh-00DFy0-T6 for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Jan 2024 09:14:33 +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 1rPfWg-002QRJ-Ub for pgsql-bugs@arkaria.postgresql.org; Tue, 16 Jan 2024 09:14:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPfWf-002QRA-8x for pgsql-bugs@lists.postgresql.org; Tue, 16 Jan 2024 09:14:30 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rPfWb-0025dP-C2 for pgsql-bugs@lists.postgresql.org; Tue, 16 Jan 2024 09:14:28 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 24A5F5C00A8; Tue, 16 Jan 2024 04:14:23 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 16 Jan 2024 04:14:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1705396463; x=1705482863; bh=GIdzkeCPPy lkAyIgLhvlO8yza31Aj69aYkYppScx/F0=; b=WwcBGObkeBc8eAyf0lK+vjiSIt Uy3BNxNS4y0N9/WoMSPU4hIvyNb9jBnwZ1vz/T8QtX6jUOkz+ORWz4B2NhNR/3ru O5XPN1D96+MYEagt7d+k+y09TM0M629Co7dZf3DtIoq2q8QKnYfHC++hiRWeQlNw trlMHiavBOcAiyEQkg7MMqUfObJxrgspnkqzXPnuSZETgIz+NBcHpDAEXuCPZveb ep8styghyLHKdiIBb4KnIGmew7eS9UPLuo8U1hDXzbOUPZZx0cSpLtRHK5xPYSCk ePg3txx2gAzfRuOepWEWlXmCw5DsJ+ftjl+xqIIAaYhYiNE+QMbKcBhKeDUQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1705396463; x=1705482863; bh=GIdzkeCPPylkAyIgLhvlO8yza31A j69aYkYppScx/F0=; b=yo/Wm0ADAi4xJbwl2zwYksyKSJguvq33t677iNFUiXCA uFh8g7hLSOAL+oHVXkoyN62fzp4VIFIZKIfSnMrsM42ZZjRUNceJo/QXmYKlCSU5 F5HJcpeyUaaARzXKTGdIMdWl6NL5sz6UPATDQmD4eOBWA6jV+AttmDmLLDk3/sXP D3/I+ewJaSxB1L7dP7rTeBWRtc2JXAbFcEQ6bLGJ4ssoSHRbGZJyVSvOPkKNgBj+ XrtwbKacH9M8mVgK2+uUnD/xp9RQkEIxJkzgc2NVIf5hWe+NEjaxtyeTpcYKIFDY Np/adLVQj0YIjG6ulPvksYQcIVWVpR8nWuEwT2ThVw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdejfedgtdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredt tddvnecuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesph grqhhuihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepffffleejgfdtgeetffdvkeei hfeuffetudfgjeeigfehiedvfeejheefgeduhfdvnecuffhomhgrihhnpehgnhhomhgvrd horhhgnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhep mhhitghhrggvlhesphgrqhhuihgvrhdrgiihii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 16 Jan 2024 04:14:21 -0500 (EST) Date: Tue, 16 Jan 2024 18:14:09 +0900 From: Michael Paquier To: Dmitry Koval Cc: Tom Lane , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18274: Error 'invalid XML content' Message-ID: References: <18274-98d16bc03520665f@postgresql.org> <1616257.1704651529@sss.pgh.pa.us> <5588db01-45be-48ff-b158-85f789bc502c@postgrespro.ru> <1314313.1705259848@sss.pgh.pa.us> <0eea123f-388a-41ea-9df3-d4606cf9ed8d@postgrespro.ru> <35ef78f9-8958-4225-ae7e-aead71b0feed@postgrespro.ru> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Cj9glJYNyqkopYO8" Content-Disposition: inline In-Reply-To: <35ef78f9-8958-4225-ae7e-aead71b0feed@postgrespro.ru> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Cj9glJYNyqkopYO8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 15, 2024 at 06:47:17PM +0300, Dmitry Koval wrote: > I think that's right (flag XML_PARSE_HUGE shouldn't cause any problems). > My main doubts are related to the replacement of the > xmlParseBalancedChunkMemory() function (that haven't argument for pass > XML_PARSE_HUGE flag) with xmlNewNode() + xmlParseInNodeContext() functions > (create a fake node and pass the XML_PARSE_HUGE flag to > xmlParseInNodeContext function). > > I'm not sure if this replacement is 100% equivalent (although simple tests > work the same). Hmm, it looks like this is actually equivalent in terms of parsing a well-balanced chunk. This was suggested in the upstream ticket you have opened and I find that pretty cool, reusing the trick of a fake root node to use the other API. Now, there are two things that we'd better do here: - Document in a comment why a fake root node is necessary (aka the current routines don't give enough control over the limits you'd like to enforce). - The top comment of xml_parse() still mentions xmlParseBalancedChunkMemory() as an effect of 483bdb2afec9, so this needs to be updated. The switch xmlParseMemory() -> xmlReadMemory() is recommended by the upstream docs and the former is deprecated: https://gnome.pages.gitlab.gnome.org/libxml2/devhelp/libxml2-parser.html#xmlParseMemory Also, it may be worth double-checking if there are other things marked as deprecated in the upstream doc, and switch to "newer" things. It seems like anything discussed here should only be done on HEAD. I suspect that the buildfarm may get bumpy on that, but let's see. -- Michael --Cj9glJYNyqkopYO8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmWmSOEACgkQnvQgOdby QH3ppw/9G0FDWZdHNC46kHqcr1JfvR7VPs07dQEhRl983i5bZhgjgRsyuH0jN68G 3IDOyJELCRWv7J2lcq8qAJUTH0Jsayop0Bzu+NQE3VwtSQePqucaRFYmn9UlbFII gzTl6viOp1HwsktZWZ2uYZ4Lxz+3KV4wdPzhOiaBlpcVsZZBPTrUeEP33y/YX3lV EEpTbppfXNhPspouUJ4suTTPiMwmim73o2D84nHuy2HmHhvysQ2lD8yePiO3qTXw fLwg2mw6tFzj8QAwTmH9GYPMwzr4NOqPf9xW7TvUH77/vZr+UcJabHoEbJdHjtCn X9pxeHelf86Ry8iaD2SPfnfbCpKtRnyu320aAD1QOk1IYxvfHnLaY7qm8LzjbnlI x0C5353n1lLlUcriymbNpdM4aVxy4CtnJAoWlZWWEEPnC8hGsxG1qz1gX4FAypEX fxXwDiDioyLVgdUIsJ4/8LZzdSWowCu2Vm1HHbnZK/b4beS8PA8Kd2F9CCgLsYF6 aap/fuIqgn2zOo+EoUifCUeXjKlUblKtFSvwIPbk9rST0RVD0i/HCqb9/WCzcgNd vzmXKBZEA80lp8FNk+/eMgoBqsFXU1RzVXhwBl1S1TrYBfz0Rr4L5QBIBqnDxg0r VX6xuLj+MVYDGCyvbVHvlcFpa1T82bHJuciqVVSWa8yi7HkwjNQ= =gC2d -----END PGP SIGNATURE----- --Cj9glJYNyqkopYO8--