Re: bytea to XML crash fix - Mailing list pgsql-hackers

From Tom Lane
Subject Re: bytea to XML crash fix
Date
Msg-id 15679.1223564880@sss.pgh.pa.us
Whole thread Raw
In response to bytea to XML crash fix  (Michael.McMaster@wrsa.com.au)
List pgsql-hackers
Michael.McMaster@wrsa.com.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


pgsql-hackers by date:

Previous
From: "Ryan Bradetich"
Date:
Subject: Re: [WIP] Reduce alignment requirements on 64-bit systems.
Next
From: Alvaro Herrera
Date:
Subject: Re: [WIP] plpgsql is not translate-aware