Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D08F9B5DBD8 for ; Fri, 27 May 2011 17:02:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 02987-06 for ; Fri, 27 May 2011 20:02:05 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 22F74B5DC0D for ; Fri, 27 May 2011 17:02:04 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p4RK24uR040937 for ; Fri, 27 May 2011 20:02:04 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p4RK24nG040936; Fri, 27 May 2011 20:02:04 GMT (envelope-from www) Date: Fri, 27 May 2011 20:02:04 GMT Message-Id: <201105272002.p4RK24nG040936@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6044: Access violation on XML decl with standalone From: "Christopher Dillard" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201105/203 X-Sequence-Number: 30342 The following bug has been logged online: Bug reference: 6044 Logged by: Christopher Dillard Email address: csdillard@gmail.com PostgreSQL version: 8.4.8 Operating system: Windows Description: Access violation on XML decl with standalone Details: Hello, In PostgreSQL 8.4.8, the function "xml_recv" (in src/backend/utils/adt/xml.c) calls the function "parse_xml_decl", passing NULL for the final "standalone" parameter. However, "parse_xml_decl" does not check for standalone==NULL, and blindly sets "*standalone = 0". This causes a crash if the xml declaration actually has a standalone parmeter, e.g. ''. I wish I could provide a SQL test case, but I only found this by setting a breakpoint on the 0xC0000005 exception in Visual Studio. (And it was closed-source third party software that was interacting with PostgreSQL when the crash occurred, so I can't attack it from that angle.) I speculate that the source code in question has something to do with binding XML parameters to prepared statements or function arguments, but since that's the first time I'd looked at the PostgreSQL source code, I couldn't say anything for sure. Am I interpreting this right? Can someone more knowledgeable provide a SQL test case? Thanks!