pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6044: Access violation on XML decl with standalone
2+ messages / 2 participants
[nested] [flat]

* BUG #6044: Access violation on XML decl with standalone
@ 2011-05-27 20:02 Christopher Dillard <csdillard@gmail.com>
  2011-05-28 02:04 ` Re: BUG #6044: Access violation on XML decl with standalone Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Christopher Dillard @ 2011-05-27 20:02 UTC (permalink / raw)
  To: pgsql-bugs


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. '<?xml version="1.0" standalone="no"?><anything/>'.

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!



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #6044: Access violation on XML decl with standalone
  2011-05-27 20:02 BUG #6044: Access violation on XML decl with standalone Christopher Dillard <csdillard@gmail.com>
@ 2011-05-28 02:04 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2011-05-28 02:04 UTC (permalink / raw)
  To: Christopher Dillard <csdillard@gmail.com>; +Cc: pgsql-bugs

"Christopher Dillard" <csdillard@gmail.com> writes:
> 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. '<?xml version="1.0" standalone="no"?><anything/>'.

Ugh, you're right.

> 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.

AFAIK there isn't any way to exercise the receive functions via psql.
You need a client that will send data as binary parameters.  But it's
obvious by inspection of the code that it's broken.  Will fix, thanks
for the report!

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-05-28 02:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27 20:02 BUG #6044: Access violation on XML decl with standalone Christopher Dillard <csdillard@gmail.com>
2011-05-28 02:04 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox