Re: bytea to XML crash fix

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael(dot)McMaster(at)wrsa(dot)com(dot)au
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: bytea to XML crash fix
Date: 2008-10-09 15:08:00
Message-ID: 15679.1223564880@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael(dot)McMaster(at)wrsa(dot)com(dot)au writes:
> I discovered a bug (server crash) with the conversion of bytea types to
> xml with base64 (and hex) encoding.

Crash confirmed here...

> The patch against the postgres backend at the end of this email seems to
> resolve the problem. I've never touched the postgres source before, and
> the patch is simply a copy & paste of code elsewhere in the source-tree
> that makes use of bytea types, so the patch may have nasty side-effects.

Yeah, the core of the problem is certainly failure to detoast the datum
before applying VARDATA etc. But this code is a hack job anyway ...
why isn't the special case for bytea an arm of the switch just above,
instead of being inserted after an output function call that it renders
useless? And is it really necessary to depend on libxml for something
as simple as base64 encoding?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2008-10-09 17:25:24 Re: [WIP] plpgsql is not translate-aware
Previous Message Ryan Bradetich 2008-10-09 14:44:14 Re: [WIP] Reduce alignment requirements on 64-bit systems.